Last active
August 6, 2020 14:49
-
-
Save AwesomeObserver/03bcbbc4f4ef6c3ccd8e1f774e375ff9 to your computer and use it in GitHub Desktop.
ng jest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"test": { | |
"builder": "@angular-builders/jest:run", | |
"options": { | |
"coverage": true, | |
"no-cache": true | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@angular-builders/jest | |
@types/jest | |
jest | |
jest-localstorage-mock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
"collectCoverageFrom": [ | |
"src/**/*.{js,ts}", | |
"!src/public-api.ts", | |
"!src/**/*.spec.{js,ts}", | |
"!src/**/*.d.ts" | |
], | |
"coverageDirectory": "<rootDir>/test-results/coverage", | |
"coverageReporters": [ | |
"lcovonly", | |
"json", | |
"html", | |
"cobertura", | |
"text", | |
"text-summary" | |
], | |
"reporters": [ | |
"default" | |
], | |
"globals": { | |
"ts-jest": { | |
"tsConfig": "<rootDir>/src/tsconfig.spec.json", | |
"stringifyContentPathRegex": "\\.html$", | |
"astTransformers": [ | |
'jest-preset-angular/build/InlineFilesTransformer', | |
'jest-preset-angular/build/StripStylesTransformer' | |
], | |
"isolatedModules": true | |
} | |
}, | |
"moduleFileExtensions": [ | |
"js", | |
"ts", | |
"html" | |
], | |
"moduleDirectories": [ | |
"node_modules", | |
"src" | |
], | |
"setupFilesAfterEnv": [ | |
"<rootDir>/setupJest.ts" | |
], | |
"testMatch": [ | |
"<rootDir>/src/**/+(*.)+(spec).+(ts|js)" | |
], | |
"transform": { | |
"^.+\\.(ts|js|html)$": "ts-jest" | |
}, | |
"transformIgnorePatterns": [ | |
"node_modules/(?!(rxjs-compat))" | |
], | |
"moduleNameMapper": { | |
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js", | |
"\\.(css)$": "<rootDir>/__mocks__/styleMock.js", | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'jest-preset-angular'; | |
import 'jest-localstorage-mock'; | |
window.requestAnimationFrame = fn => { | |
fn(16); | |
return 16; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment