Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This error message in Angular 14 and Jest means that the file setup-jest.ts is being imported from outside of a module. In order to import a file in Jest, it must be within a module that is being tested or within the test file itself.

To fix this error, move the import statement for setup-jest.ts to inside a module or test file that is being executed by Jest. Alternatively, consider refactoring setup-jest.ts to be a module itself that can be imported from within a test file or test module.