Skip to content

overengineered/jest-import-spy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enables inspecting imports in Jest tests

Usage

// Jest config
{
  "runtime": "jest-import-spy"
}
import {collectImports} from 'jest-import-spy';

test('imports', () => {
  const imports = collectImports(() => {
    jest.isolateModules(() => {
      require('./src');
    });
  });
  expect(imports).toEqual(['./src/index.js', './src/utils.js', 'lodash']);
});

About

Observe module imports in Jest tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published