Skip to content

Commit

Permalink
Add test for module.loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Oct 7, 2017
1 parent e674374 commit 0c98697
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/jest-runtime/src/__tests__/runtime_require_module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ describe('Runtime requireModule', () => {
});
}));

it('provides `module.loaded` to modules', () =>
createRuntime(__filename).then(runtime => {
const exports = runtime.requireModule(
runtime.__mockRootPath,
'RegularModule',
);
expect(exports.loaded).toEqual(false);
expect(exports.getIsLoaded()).toEqual(true);
}));

it('provides `module.filename` to modules', () =>
createRuntime(__filename).then(runtime => {
const exports = runtime.requireModule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ exports.parent = module.parent;
exports.paths = module.paths;
exports.setModuleStateValue = setModuleStateValue;
exports.module = module;
exports.loaded = module.loaded;
exports.getIsLoaded = () => module.loaded;

0 comments on commit 0c98697

Please sign in to comment.