src/test.ts not found
See original GitHub issuejest@24.5.0 jest-extended@0.11.1 jest-preset-angular@7.0.1 @angular/*@7.2.11 @angular/cli@7.3.7
FAIL src/app/file.spec.ts
● Test suite failed to run
TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
error TS6053: File 'C:/Users/.../projectHome/src/test.ts' not found.
I just upgraded from jest-preset-angular 6 to 7 and I get this error. Downgrading to version 6.0.2 works.
This are my config files:
// jest.config.js
module.exports = {
preset: 'jest-preset-angular',
roots: ['src'],
setupFilesAfterEnv: ["./src/setup-jest.ts"],
transformIgnorePatterns: [
"node_modules/(?!@ngrx|angular2-ui-switch|ng-dynamic)"
],
testPathIgnorePatterns: [
'/node_modules/',
'/src/environments/'
],
moduleDirectories: [
".",
"src",
"src/util",
"node_modules"
],
moduleNameMapper: {
'@config/(.*)': 'src/app/config/$1',
'@dashboard/(.*)': 'src/app/dashboard/$1',
'@documents/(.*)': 'src/app/documents/$1',
"@kyc/(.*)": "src/app/kyc/$1",
'@logging/(.*)': 'src/app/logging/$1',
'@mapping/(.*)': 'src/app/mapping/$1',
'@reviews/(.*)': 'src/app/review/$1',
'@root/(.*)': 'src/app/root/$1',
'@shared/(.*)': 'src/app/shared/$1',
'@signalr/(.*)': 'src/app/signalr/$1',
'@store': 'src/app/store',
'@store/(.*)': 'src/app/store/$1',
'@users/(.*)': 'src/app/users/$1',
'@util': 'src/app/util',
'@util/(.*)': 'src/app/util/$1',
"@verifications/(.*)": "src/app/verifications/$1",
}
};
// src/setup-jest.js
import 'jest-preset-angular';
import './jestGlobalMocks';
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
javascript - Angular testing - test.ts not found - Stack Overflow
I've done an npm install and when I run ng serve it builds fine. When I run ng test using the CLI, I...
Read more >How I do configure Jest to test my Angular 8 Project - ITNEXT
By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can ... It...
Read more >ts-node - npm
ts ) and TypeScript resolves dependencies based on imports and references. Occasionally, this optimization leads to missing types. Fortunately, ...
Read more >Configuring Jest
To read TypeScript configuration files Jest requires ts-node . ... no tests exist for this file and it's never required in the test...
Read more >Component testing scenarios - Angular
You update the beforeEach to find that element with a standard HTML querySelector and ... If you use the Angular CLI, configure this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I removed the src/test.ts along with the angular.json “test” script karma builder as I don’t need them. I just test with the command “jest”.
Oh, I’m sorry, I didn’t look at tsconfig.spec. I jsut removed test.ts from files array. Sorry.