-
Notifications
You must be signed in to change notification settings - Fork 309
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
test(unit): update unit tests in the example apps #1165
Conversation
Hm, ESM tests are failing. I have not tested these locally.
PS: Oh, I see.. |
I'll push a fix in a minute. |
Hi, thanks a lot for your effort. Actually the purpose of #110 is to include all the tests of the Angular example app Tour of Heroes. It would be better if you can convert those tests there to use Jest and add them to the example apps in |
@ahnpnl I'll take a look. If it is removed esm tests will fail. |
It is better to do Another thing I just noticed is: test ESM with |
@ahnpnl I rebased, updated tsconfigs, and updated unit tests so that it works.
All tests in other example apps passed successfully locally. jest-preset-angular/examples/example-app-v13$ yarn test-esm
yarn run v1.22.17
$ node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm.config.js --no-cache
ngcc-jest-processor: running ngcc
FAIL src/app/guards/route.guard.spec.ts
● Test suite failed to run
Must use import to load ES Module: /media/suser/DATA/git/rfprod/jest-preset-angular/examples/example-app-v13/node_modules/@angular/core/fesm2015/testing.mjs
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:972:21)
FAIL src/app/app.component.spec.ts
● Test suite failed to run
Must use import to load ES Module: /media/suser/DATA/git/rfprod/jest-preset-angular/examples/example-app-v13/node_modules/@angular/core/fesm2015/testing.mjs
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:972:21)
FAIL src/app/services/foo.service.spec.ts
● Test suite failed to run
Must use import to load ES Module: /media/suser/DATA/git/rfprod/jest-preset-angular/examples/example-app-v13/node_modules/@angular/core/fesm2015/testing.mjs
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:972:21)
Test Suites: 3 failed, 3 total
Tests: 0 total
Snapshots: 0 total
Time: 2.232 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
- [X] add more specs to existing example application;
- [X] add include property to tsconfigs for esm specs;
- [X] rebase onto the main branch; - [X] include src/environment in compilation instead of src/**;- [X] fix unit tests after rebasing the branch; test(unit): fix leftovers - [X] fix unit tests in example apps v11, 12, 12-monorepo, yarn workspace;
ESM mode with Angular 13 isn’t supported yet :) |
- [X] refactor app component specs; - [X] fix typos in environment config notes;
I suggest an approach like following:
|
Summary
include
property to tsconfigs for esm specs; without it esm specs are failing, can't find exports;Test plan
All unit tests should be green.
I tested locally everything (including
yarn test-esm
) except Angular v13 tests.I could not make Angular v13 unit tests work locally, but I am pretty sure the specs that were added should pass.
Does this PR introduce a breaking change?
Other information