• 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
..
integration Loading commit data...
annotation-fixtures.js Loading commit data...
bootstrap.js Loading commit data...
build-thread-test.js Loading commit data...
cross-origin-rpc-test.js Loading commit data...
fake-redux-store.js Loading commit data...
get-api-url-test.js Loading commit data...
group-fixtures.js Loading commit data...
host-config-test.js Loading commit data...
markdown-commands-test.js Loading commit data...
media-embedder-test.js Loading commit data...
render-markdown-test.js Loading commit data...
search-client-test.js Loading commit data...
service-config-test.js Loading commit data...
virtual-thread-list-test.js Loading commit data...
websocket-test.js Loading commit data...