Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ui snapshot testing #1132

Open
akshaymhetre opened this issue Apr 8, 2019 · 1 comment
Open

Ui snapshot testing #1132

akshaymhetre opened this issue Apr 8, 2019 · 1 comment

Comments

@akshaymhetre
Copy link
Contributor

Child of #1075

Snapshot based unit testing for UI

@akshaymhetre
Copy link
Contributor Author

Referred following doc to integrate Jest with angular :
https://medium.com/@nerdic.coder/how-to-use-jest-unit-tests-with-angular-87509b500158

Apart from this, was getting TS:2339 : property 'toMatchSnapshot' does not exist on type Matchers<ComponentFixture>

Resolved this by adding globals diagnosis configuration (also added options which were default for jest-preset-angular)

"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": [
"/src/setupJest.ts"
],
"globals": {
"ts-jest": {
"tsConfig": "/src/tsconfig.spec.json", // default for jest-preset-angular
"stringifyContentPathRegex": "\.html$", // default for jest-preset-angular
"astTransformers": ["node_modules/jest-preset-angular/InlineHtmlStripStylesTransformer"], // default for jest-preset-angular
"diagnostics": {
"ignoreCodes": ["6059", "18002", "18003", "TS2339"] //apart from TS2339 all were default for jest-preset-angular
}
}
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant