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

CircleCI Jest error with [email protected] #349

Closed
thinkh opened this issue Apr 1, 2020 · 2 comments
Closed

CircleCI Jest error with [email protected] #349

thinkh opened this issue Apr 1, 2020 · 2 comments
Assignees
Labels
priority: high type: bug Something isn't working

Comments

@thinkh
Copy link
Member

thinkh commented Apr 1, 2020

  • Release number or git hash: create a new branch on tdp_core
  • Web browser version and OS: independent
  • Environment (local or deployed): independent

Observed behavior

  1. CircleCI build 1559: lineupjs4 branch from 30.03.2020
  2. CircleCI build 1561: thinkh/331_string-filter-compatibility branch from 30.03.2020
    • first occurence of Jest error
  3. CircleCI build 1570: thinkh/347_fix-overview-column branch from 01.04.2020
  4. CircleCI build 1581: rebuild of lineupjs4 branch from 01.04.2020
> [email protected] test:web /home/circleci/phovea
> test ! $(find tests -name "*.ts") || jest

sh: 1: test: tests/lineup/internal/cmds.test.ts: unexpected operator
 PASS  tests/cached.test.ts
 FAIL  tests/lineup/internal/cmds.test.ts
  ● Test suite failed to run

    TypeError: Unable to require `.d.ts` file for file: index.ts.
    This is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension available alongside `index.ts`.

      at compileFn (node_modules/ts-jest/dist/compiler/language-service.js:74:23)
      at Object.compile (node_modules/ts-jest/dist/compiler/instance.js:81:25)
      at TsJestTransformer.process (node_modules/ts-jest/dist/ts-jest-transformer.js:96:41)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:446:35)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:525:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:563:25)

 FAIL  tests/select3.test.ts
  ● Test suite failed to run

    TypeError: Unable to require `.d.ts` file for file: index.ts.
    This is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension available alongside `index.ts`.

      at compileFn (node_modules/ts-jest/dist/compiler/language-service.js:74:23)
      at Object.compile (node_modules/ts-jest/dist/compiler/instance.js:81:25)
      at TsJestTransformer.process (node_modules/ts-jest/dist/ts-jest-transformer.js:96:41)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:446:35)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:525:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:563:25)

Test Suites: 2 failed, 1 passed, 3 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        4.229s
Ran all test suites.

Expected behavior

The test should run without errors.

@thinkh thinkh added type: bug Something isn't working priority: high labels Apr 1, 2020
@thinkh thinkh self-assigned this Apr 1, 2020
@thinkh
Copy link
Member Author

thinkh commented Apr 1, 2020

After a lot of test-and-error CircleCI builds I found the error between the last successful build #1559 and #1561 with the following two diff in the dependency logs:

  ├─┬ [email protected]
- │ ├── @jest/[email protected]
+ │ ├── @jest/[email protected]
  │ ├── [email protected]
- │ └── [email protected]
+ │ └── [email protected]
- ├─┬ [email protected]
+ ├─┬ [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
- │ ├── [email protected] deduped
+ │ ├── [email protected]
  │ ├── [email protected] deduped
- │ ├── [email protected]
- │ └── [email protected]
+ │ ├── [email protected]
+ │ └── [email protected]

Since jest itself has not changed, the error must be caused by ts-jest. Reverting the ts-jest version to the last version 25.2.1 fixed the CircleCI problem.

The ts-jest changelog v25.3.0 states a breaking change:

25.3.0 (2020-03-30)

Bug Fixes

  • add jest-config to dependencies list (6d9e0d8)
  • always do type check for all files provided to ts-jest transformer (#1450) (107e062)
  • docs: correct changelog, correct version in package.json (#1406) (542e181)

Chores

Features

  • compiler: expose internal ts Program via ConfigSet TsCompiler (#1433) (7153246)
  • config: add incremental option (#1418) (5a69bce)

BREAKING CHANGES

  • config: This will affect to any snapshots or assertion against diagnostics messages

Furthermore, we cache the npm dependencies on CircleCI for a specific branch and only update them when the package.json is changed OR a new branch is pushed.

@thinkh
Copy link
Member Author

thinkh commented Apr 1, 2020

Explanation what has happened:

  • build 1559 of lineupjs4 is successful, because ts-jest was not released at that time
  • [email protected] was released
  • build 1561 of thinkh/331_string-filter-compatibility fails
    • reason: new branch = install new npm dependencies with ts-jest
  • build 1570 of thinkh/347_fix-overview-column fails
    • reason: new branch = install new npm dependencies with ts-jest

I expect other branches (also from develop branch) to fail, because they will install the new ts-jest version.

The fix would be switch to the ~ version for ts-jest:

- "ts-jest": "^25.2.1",
+ "ts-jest": "~25.2.1",

@anita-steiner and @dvvanessastoiber would that work that fix for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants