-
Notifications
You must be signed in to change notification settings - Fork 306
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
resolve conflicts in "feat/jest24" PR #230
Conversation
This PR introduces jsdom v13 as default test environment for jest-preset-angular. This is achieved by * Adding [jest-environment-jsdom-thirteen](https://github.com/theneva/jest-environment-jsdom-thirteen) as dependency * Adding `testEnvironment: 'jest-environment-jsdom-thirteen' to `jest-preset.js` * Removing Web Storage API mocks from `example/jestGlobalmocks.ts` * Adding instructions in README Troubleshooting to configure usage of jsdom v11 (one line in jest configuration) I added tests in a second commit to confirm it works, but I think they do not have to end up in the repository, as they basically test, what is already tested in jsdom itself. Closes thymikee#216
Not sure why ci/circleci: install-test-example failed: #!/bin/bash -eo pipefail
cd example
yarn test:ci
yarn test:coverage
yarn run v1.13.0
$ jest --runInBand
● Validation Error:
Module jest-preset-angular should have "jest-preset.js" or "jest-preset.json" file at the root.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1 When I run it locally: foo@bar F:\oo\jest-preset-angular feat/jest24 ≣ [09:22:19 PM]
❯ pwd
Path
----
F:\oo\jest-preset-angular
foo@bar F:\oo\jest-preset-angular feat/jest24 ≣ [09:22:20 PM]
❯ cd .\example\
foo@bar F:\oo\jest-preset-angular\example feat/jest24 ≣ [09:22:23 PM]
❯ yarn test:ci
yarn run v1.13.0
$ jest --runInBand
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
PASS src/app/service/hero.service.spec.ts
PASS src/app/app.component.spec.ts
PASS src/app/on-push/on-push.component.spec.ts
PASS src/app/heroes/heroes.component.spec.ts
PASS src/app/simple/simple.component.spec.ts
PASS src/app/calc/calc.component.spec.ts
Test Suites: 6 passed, 6 total
Tests: 17 passed, 17 total
Snapshots: 6 passed, 6 total
Time: 4.433s
Ran all test suites.
Done in 5.72s.
foo@bar F:\oo\jest-preset-angular\example feat/jest24 ≣ [09:22:32 PM]
❯ yarn test:coverage
yarn run v1.13.0
$ jest --coverage
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
ts-jest[versions] (WARN) Version 24.0.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=22.0.0 <24.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
PASS src/app/service/hero.service.spec.ts
PASS src/app/calc/calc.component.spec.ts
PASS src/app/simple/simple.component.spec.ts
PASS src/app/on-push/on-push.component.spec.ts
PASS src/app/heroes/heroes.component.spec.ts
PASS src/app/app.component.spec.ts
------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
------------------------|----------|----------|----------|----------|-------------------|
All files | 96.94 | 50 | 87.5 | 96.1 | |
src | 75 | 100 | 0 | 75 | |
jestGlobalMocks.ts | 66.67 | 100 | 0 | 66.67 | 7,19 |
setupJest.ts | 100 | 100 | 100 | 100 | |
src/app | 100 | 100 | 100 | 100 | |
app.component.html | 100 | 100 | 100 | 100 | |
app.component.ts | 100 | 100 | 100 | 100 | |
src/app/calc | 100 | 100 | 100 | 100 | |
calc.component.ts | 100 | 100 | 100 | 100 | |
src/app/heroes | 100 | 100 | 100 | 100 | |
heroes.component.html | 100 | 100 | 100 | 100 | |
heroes.component.ts | 100 | 100 | 100 | 100 | |
src/app/on-push | 100 | 100 | 100 | 100 | |
on-push.component.ts | 100 | 100 | 100 | 100 | |
src/app/service | 95.45 | 100 | 83.33 | 94.44 | |
hero.service.ts | 95.45 | 100 | 83.33 | 94.44 | 20 |
src/app/simple | 100 | 100 | 100 | 100 | |
simple.component.html | 100 | 100 | 100 | 100 | |
simple.component.ts | 100 | 100 | 100 | 100 | |
src/lib/testing | 100 | 50 | 100 | 100 | |
config.helpers.ts | 100 | 50 | 100 | 100 | 10 |
index.ts | 100 | 100 | 100 | 100 | |
------------------------|----------|----------|----------|----------|-------------------|
Test Suites: 6 passed, 6 total
Tests: 17 passed, 17 total
Snapshots: 6 passed, 6 total
Time: 6.112s
Ran all test suites.
Done in 7.48s.
foo@bar F:\oo\jest-preset-angular\example feat/jest24 ≣ [09:22:44 PM]
❯ |
Could it be cache related ? |
I get the same error when I checkout your branch in a clean workspace and run
I cannot tell you what exactly triggers this error, but whenever I had this error before, something with the jest config in the example project or in |
Inspected a bit and this is what happens:
Looks like Anyway, the kulshekhar/ts-jest#957 was merged and released as stable too quickly, it still has issues around Babel resolution. |
it's kind of weird because v24 generated changelog doesn't include anything about no |
Actually it has defaults, but it only contains the A dirty workaround (till we figure out what changed) would be:
|
It's likely a bug
This is not a good workaround, as Jest will only resolve to |
Btw, feel free to send a PR to Jest. Should be as easy as adding this diff: diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js
index 4c2bee56f..f938d520e 100644
--- a/packages/jest-config/src/normalize.js
+++ b/packages/jest-config/src/normalize.js
@@ -95,9 +95,11 @@ const setupPreset = (
// $FlowFixMe
preset = (require(presetModule): InitialOptions);
} catch (error) {
- if (error instanceof SyntaxError) {
+ if (error instanceof SyntaxError || error instanceof TypeError) {
throw createConfigError(
- ` Preset ${chalk.bold(presetPath)} is invalid:\n ${error.message}`,
+ ` Preset ${chalk.bold(presetPath)} is invalid:\n\n ${
+ error.message
+ }\n ${error.stack}`,
);
} And updating/adding a test and a changelog. Free contribution is waiting! 😄 |
The culprit is here 😅 : kulshekhar/ts-jest@1d67101#diff-ad00ea7d7e62419810391b7b4dfaadf0L11 The default config from the |
Heh, yea, it's now not necessary. Forgot about it. Anyway, we should set |
closing this pull request as it's inclusion of |
Brought in latest from the
master
branch and usedts-jest@24.0.0
To resolve conflicts in #224