Skip to content

[Feature]: Improve error message when transformation has no emit due to any error and noEmitOnError: true #5197

@jet2jet

Description

@jet2jet

🚀 Feature Proposal

When tsconfig.json includes noEmitOnError: true and any compilation error occurs (including tsconfig.json is invalid or the source code has syntax error), ts-jest outputs error message as follows:

    Unable to process '/path/to/src/foo.test.mts', please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to inform `ts-jest` to transform /path/to/src/foo.test.mts

It is happy that the 'cause' error will be output.

Motivation

When investigating #5196, the above error message is output but was confusing. With Node.js debugging,

const output: EmitOutput = this._languageService.getEmitOutput(fileName)

above EmitOutput has diagnostics with cause errors, so I found the problem.

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions