jest-import-spy
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Enables inspecting imports in Jest tests

Usage

// Jest config
{
  "moduleLoader": "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']);
});

Readme

Keywords

Package Sidebar

Install

npm i jest-import-spy

Weekly Downloads

0

Version

1.3.0

License

MIT

Unpacked Size

11.5 kB

Total Files

5

Last publish

Collaborators

  • overengineered