Skip to content

Jest won't recognise test files outside src folder #36

@calebdeji

Description

@calebdeji

my jest.config.js file is this

module.exports = {
	moduleFileExtensions: ['ts', 'js'],
	testRegex: '/__tests__/.*\\.(ts|js)$',
	transformIgnorePatterns: ['<rootDir>/node_modules/']
};

I have my test files in tests folder

Console ouptut

npm test  

> use-network-status-code@1.0.0 test /home/calebdeji/workspace/open-source/use-network-status
> cross-env CI=1 react-scripts test --env=jsdom

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /home/calebdeji/workspace/open-source/use-network-status
  3 files checked.
  testMatch: /home/calebdeji/workspace/open-source/use-network-status/src/**/__tests__/**/*.{js,jsx,ts,tsx}, /home/calebdeji/workspace/open-source/use-network-status/src/**/*.{spec,test}.{js,jsx,ts,tsx} - 0 matches
  testPathIgnorePatterns: /node_modules/ - 3 matches
  testRegex:  - 0 matches
Pattern:  - 0 matches
npm ERR! Test failed.  See above for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions