• 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
..
test Loading commit data...
account-id.js Loading commit data...
annotation-metadata.js Loading commit data...
annotation-sharing.js Loading commit data...
array.js Loading commit data...
copy-to-clipboard.js Loading commit data...
date.js Loading commit data...
disable-opener-for-external-links.js Loading commit data...
dom.js Loading commit data...
fetch-config.js Loading commit data...
group-list-item-common.js Loading commit data...
group-organizations.js Loading commit data...
groups.js Loading commit data...
is-sidebar.js Loading commit data...
is-third-party-service.js Loading commit data...
memoize.js Loading commit data...
oauth-client.js Loading commit data...
observe-element-size.js Loading commit data...
on-activate.js Loading commit data...
postmessage-json-rpc.js Loading commit data...
random.js Loading commit data...
retry.js Loading commit data...
scope-timeout.js Loading commit data...
sentry.js Loading commit data...
service-context.js Loading commit data...
session.js Loading commit data...
state.js Loading commit data...
tabs.js Loading commit data...
theme.js Loading commit data...
time.js Loading commit data...
url.js Loading commit data...
version-data.js Loading commit data...
wrap-react-component.js Loading commit data...