diff --git a/src/index.spec.ts b/src/index.spec.ts index 7f6fca3be..9ab8ac6d1 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -213,6 +213,18 @@ describe('ts-node', function () { }) }) + it('should throw error even in transpileOnly mode', function (done) { + exec(`${BIN_EXEC} --transpile-only -pe "console."`, function (err) { + if (err === null) { + return done('Command was expected to fail, but it succeeded.') + } + + expect(err.message).to.contain('error TS1003: Identifier expected') + + return done() + }) + }) + it('should pipe into `ts-node` and evaluate', function (done) { const cp = exec(BIN_EXEC, function (err, stdout) { expect(err).to.equal(null) diff --git a/src/index.ts b/src/index.ts index a4f32385b..854a4d041 100644 --- a/src/index.ts +++ b/src/index.ts @@ -442,7 +442,7 @@ export function create (options: CreateOptions = {}): Register { filterDiagnostics(result.diagnostics, ignoreDiagnostics) : [] - if (diagnosticList.length) reportTSError(configDiagnosticList) + if (diagnosticList.length) reportTSError(diagnosticList) return [result.outputText, result.sourceMapText as string] }