--check-visual-regressions not working in Jest 28
bendehghan opened this issue · 9 comments
Versions
Playground version: 10.0.1
Angular CLI: 14.1.2
Node: 16.14.2
Package Manager: npm 8.5.5
OS: darwin x64
Angular: 14.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1401.2
@angular-devkit/build-angular 14.1.2
@angular-devkit/core 14.1.2
@angular-devkit/schematics 14.1.2
@schematics/angular 14.1.2
rxjs 7.5.6
typescript 4.7.4
Jest version: 28.1.3
Repro steps
npx angular-playground --config angular-playground.json --check-visual-regressions --visual-regression-mock-date 1579503234000
Observed Behavior
The result is this:
[...]
Build at: 2022-09-12T18:49:43.399Z - Hash: d37082b37e7c8e9b - Time: 47248ms
[ng serve]:
** Angular Live Development Server is listening on 127.0.0.1:57762, open your browser on http://127.0.0.1:57762/ **
✔ Compiled successfully.
Determining test suites to run...
ngcc-jest-processor: running ngcc
FAIL ./test-image-snapshots-800x600.js
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'testEnvironmentOptions')
at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:73:28)
at runMicrotasks (<anonymous>)
at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
at async runJest (node_modules/@jest/core/build/runJest.js:404:19)
at async _run10000 (node_modules/@jest/core/build/cli/index.js:320:7)
at async runCLI (node_modules/@jest/core/build/cli/index.js:173:3)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.797 s
Any other details that may be useful (optional)
I think the issue might be related to this: https://jestjs.io/docs/28.x/upgrading-to-jest28#jsdom
which says that jest-environment-jsdom is needs to be installed separately in jest 28.
Incidentally Jest is now v29 but I haven't gotten to have it work so haven't tried playground with it either.
Hi @bendehghan
Thanks for reporting this. We would love to have you submit a pull request to fix this issue. Thank you!
I tried but had a hard time building the code I got from github. If you update the build instructions so that I can build it I can attempt to make the changes maybe. :)
Maybe you're relying on some special shell commands I don't have.
$ npm run playground:build && npm run playground
> cli-example@0.0.0 playground:build
> (cd ../../ && sh ./scripts/build.sh)
sh: ./scripts/build.sh: No such file or directory
Any update on this?
Where can I find file build.sh??
Thanks
I'm on mac. This seems like a windows thing, no?
The issue I have is that your code is referring to
./scripts/build.sh
which is missing in the tree.
@bendehghan please take another look at the contribution instructions as I have updated them. https://github.com/SoCreate/angular-playground/blob/master/CONTRIBUTING.md
Ok. Here's the PR:
#316
This is great. Thank you. Will you do a patch release for this?