diff --git a/src/index.spec.ts b/src/index.spec.ts index cb248a7bc..45cdb4c8c 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -805,28 +805,26 @@ describe('ts-node', function () { }) }) - describe('support a transpile only mode', () => { - it('should execute successfully with type errors and transpile-only enabled', (done) => { - exec(`${cmd}/transpile-only index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) { - expect(err).to.equal(null) - expect(stdout).to.equal('foo bar baz biff\n') + it('should support transpile only mode via dedicated loader entrypoint', (done) => { + exec(`${cmd}/transpile-only index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) { + expect(err).to.equal(null) + expect(stdout).to.equal('') - return done() - }) + return done() }) - it('should throw an error with type errors and transpile-only disabled', (done) => { - exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) { - if (err === null) { - return done('Command was expected to fail, but it succeeded.') - } + }) + it('should throw type errors without transpile-only enabled', (done) => { + exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) { + if (err === null) { + return done('Command was expected to fail, but it succeeded.') + } - expect(err.message).to.contain('Unable to compile TypeScript') - expect(err.message).to.match(new RegExp('TS2345: Argument of type \'(?:number|1101)\' is not assignable to parameter of type \'string\'\\.')) - expect(err.message).to.match(new RegExp('TS2322: Type \'(?:"hello world"|string)\' is not assignable to type \'number\'\\.')) - expect(stdout).to.equal('') + expect(err.message).to.contain('Unable to compile TypeScript') + expect(err.message).to.match(new RegExp('TS2345: Argument of type \'(?:number|1101)\' is not assignable to parameter of type \'string\'\\.')) + expect(err.message).to.match(new RegExp('TS2322: Type \'(?:"hello world"|string)\' is not assignable to type \'number\'\\.')) + expect(stdout).to.equal('') - return done() - }) + return done() }) }) }