Skip to content

Commit

Permalink
Tighten type definition of Module
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Oct 7, 2017
1 parent 1705e8b commit 32e302c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ describe('Runtime requireModule', () => {
'RegularModule',
);
expect(Object.keys(exports.module)).toEqual([
'children',
'exports',
'filename',
'id',
'loaded',
'children',
'parent',
'paths',
]);
Expand All @@ -51,11 +51,11 @@ describe('Runtime requireModule', () => {
'RequireRegularModule',
);
expect(Object.keys(exports.parent)).toEqual([
'children',
'exports',
'filename',
'id',
'loaded',
'children',
'parent',
'paths',
]);
Expand Down
6 changes: 4 additions & 2 deletions packages/jest-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ import {run as cilRun} from './cli';
import {options as cliOptions} from './cli/args';

type Module = {|
children?: Array<any>,
children: Array<Module>,
exports: any,
filename: string,
id: string,
loaded: boolean,
parent?: Module,
paths?: Array<Path>,
require?: Function,
require?: (id: string) => any,
|};

type HasteMapOptions = {|
Expand Down Expand Up @@ -313,6 +313,7 @@ class Runtime {
// circular dependencies that may arise while evaluating the module can
// be satisfied.
const localModule: Module = {
children: [],
exports: {},
filename: modulePath,
id: modulePath,
Expand Down Expand Up @@ -386,6 +387,7 @@ class Runtime {

if (manualMock) {
const localModule: Module = {
children: [],
exports: {},
filename: modulePath,
id: modulePath,
Expand Down

0 comments on commit 32e302c

Please sign in to comment.