Skip to content

Emit skipped for language serviceย #2374

@BorntraegerMarc

Description

@BorntraegerMarc

๐Ÿ› Bug Report

Every now and then I receive the following error when running my ts-jest tests:

 FAIL  test.spec.ts
  โ— Test suite failed to run

    TypeError: test.spec.ts: Emit skipped for language service

      at compileFn (../node_modules/ts-jest/dist/compiler/language-service.js:269:23)
      at Object.compile (../node_modules/ts-jest/dist/compiler/instance.js:39:21)
      at TsJestTransformer.process (../node_modules/ts-jest/dist/ts-jest-transformer.js:85:41)
      at ScriptTransformer.transformSource (../node_modules/@jest/transform/build/ScriptTransformer.js:464:35)
      at ScriptTransformer._transformAndBuildScript (../node_modules/@jest/transform/build/ScriptTransformer.js:569:40)
      at ScriptTransformer.transform (../node_modules/@jest/transform/build/ScriptTransformer.js:607:25)

To Reproduce

This bug seems to happen "randomly". I know, I know... Nothing happens randomly. However this bug seems to happen to our entire dev team every day.

When it happens then no single test suite can be run.

When it happens we've tried clearing node_modules & build folder & run npx jest --clearCache. This sometimes seems to fix the issue. But not always. The only thing that really seems to fix the issue (temporarily) is to delete the whole git project & re-clone it.

Before you ask: Yes, I'm aware of #1500. However any "fix" that was published doesn't seem to work. Also this issue is about a "random" failure that happens "now and then". Not something reproducible. At this point I strongly believe it's a bug in this library (or in one of it's dependencies).

I opened this issue also to get feedback from the community if any others had this reoccurring issue?

Expected behavior

No exception happens.

Link to repo (highly encouraged)

tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "noLib": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es6",
        "sourceMap": true,
        "allowJs": true,
        "outDir": "./build",
        "baseUrl": "./"
    },
    "include": ["."],
    "exclude": ["./node_modules"]
}

package.json config:

    "jest": {
        "moduleFileExtensions": [
            "js",
            "json",
            "ts"
        ],
        "rootDir": "src",
        "testRegex": ".spec.ts$",
        "transform": {
            "^.+\\.(t|j)s$": "ts-jest"
        },
        "coverageDirectory": "./coverage",
        "testEnvironment": "node"
    }

Debug log:

NOTE: Couldn't copy the whole ts-jest.log because it's too big. So instead I uploaded the file:

ts-jest.log

envinfo

System:
    OS: Mac
    Node version: 12.13.0

Npm packages:
    jest: 26.6.3
    ts-jest: 26.5.0
    typescript: 4.1.3
    babel(optional):

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      โšก