SoCreate / angular-playground

A drop in app module for working on Angular components in isolation (Angular version 2.x and above).
http://www.angularplayground.it
MIT License
457 stars 62 forks source link

--check-visual-regressions not working in Jest 28 #314

Closed bendehghan closed 1 year ago

bendehghan commented 2 years ago

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.

JustinCouto commented 2 years ago

Hi @bendehghan

Thanks for reporting this. We would love to have you submit a pull request to fix this issue. Thank you!

bendehghan commented 2 years ago

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
bendehghan commented 2 years ago

Any update on this? Where can I find file build.sh??

Thanks

JustinCouto commented 2 years ago

Hey Ben,

If you download and install Cmder

https://github.com/cmderdev/cmder

That should have everything you need to build it. Sorry, I meant to send this to you the other day and I got pulled away in the middle of it

Thank you,

Justin Couto CEO @ SoCreate


From: Ben Dehghan @.> Sent: Tuesday, September 20, 2022 11:57:10 AM To: SoCreate/angular-playground @.> Cc: Justin Couto @.>; Comment @.> Subject: Re: [SoCreate/angular-playground] --check-visual-regressions not working in Jest 28 (Issue #314)

Any update on this? Where can I find file build.sh??

Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/SoCreate/angular-playground/issues/314#issuecomment-1252780752, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABGZQDYFXS62ASHZHLHJYYDV7ICINANCNFSM6AAAAAAQK3YFSI. You are receiving this because you commented.Message ID: @.***>

bendehghan commented 2 years ago

I'm on mac. This seems like a windows thing, no?

bendehghan commented 2 years ago

The issue I have is that your code is referring to ./scripts/build.sh which is missing in the tree.

lurock commented 2 years ago

@bendehghan please take another look at the contribution instructions as I have updated them. https://github.com/SoCreate/angular-playground/blob/master/CONTRIBUTING.md

bendehghan commented 1 year ago

Ok. Here's the PR: https://github.com/SoCreate/angular-playground/pull/316

bendehghan commented 1 year ago

This is great. Thank you. Will you do a patch release for this?