• Robert Knight's avatar
    Modify a mocking idiom that doesn't work with ES modules · 426d2670
    Robert Knight authored
    We have an idiom in many tests where we import the "default export" from
    a module and then access the `$imports` property on that
    function/class/object in order to mock or unmock imports. For example:
    
    ```
    const Widget = require('../widget');
    
    beforeEach(() => {
      Widget.$imports.$mock(...);
    });
    
    afterEach(() => {
      Widget.$imports.$restore();
    });
    ```
    
    This won't work when the module under test is converted to an ES module
    because the `$imports` object will become a separate export from the
    module rather than a property of the default export.
    426d2670
Name
Last commit
Last update
..
account-id-test.js Loading commit data...
annotation-metadata-test.js Loading commit data...
annotation-sharing-test.js Loading commit data...
copy-to-clipboard-test.js Loading commit data...
disable-opener-for-external-links-test.js Loading commit data...
dom-test.js Loading commit data...
fake-window.js Loading commit data...
fetch-config-test.js Loading commit data...
group-list-item-common-test.js Loading commit data...
group-organizations-test.js Loading commit data...
groups-test.js Loading commit data...
is-sidebar-test.js Loading commit data...
is-third-party-service-test.js Loading commit data...
memoize-test.js Loading commit data...
oauth-client-test.js Loading commit data...
observe-element-size-test.js Loading commit data...
postmessage-json-rpc-test.js Loading commit data...
random-test.js Loading commit data...
retry-test.js Loading commit data...
scope-timeout-test.js Loading commit data...
sentry-test.js Loading commit data...
service-context-test.js Loading commit data...
session-test.js Loading commit data...
state-test.js Loading commit data...
tabs-test.js Loading commit data...
theme-test.js Loading commit data...
time-test.js Loading commit data...
url-test.js Loading commit data...
version-data-test.js Loading commit data...
wrap-react-component-test.js Loading commit data...