Skip to content

Commit 525b730

Browse files
author
Concision
committed
feat: Renamed and restructured esm-transpile-only tests
1 parent 786903e commit 525b730

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/index.spec.ts

+16-18
Original file line numberDiff line numberDiff line change
@@ -805,28 +805,26 @@ describe('ts-node', function () {
805805
})
806806
})
807807

808-
describe('support a transpile only mode', () => {
809-
it('should execute successfully with type errors and transpile-only enabled', (done) => {
810-
exec(`${cmd}/transpile-only index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) {
811-
expect(err).to.equal(null)
812-
expect(stdout).to.equal('foo bar baz biff\n')
808+
it('should support transpile only mode via dedicated loader entrypoint', (done) => {
809+
exec(`${cmd}/transpile-only index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) {
810+
expect(err).to.equal(null)
811+
expect(stdout).to.equal('')
813812

814-
return done()
815-
})
813+
return done()
816814
})
817-
it('should throw an error with type errors and transpile-only disabled', (done) => {
818-
exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) {
819-
if (err === null) {
820-
return done('Command was expected to fail, but it succeeded.')
821-
}
815+
})
816+
it('should throw type errors without transpile-only enabled', (done) => {
817+
exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm-transpile-only') }, function (err, stdout) {
818+
if (err === null) {
819+
return done('Command was expected to fail, but it succeeded.')
820+
}
822821

823-
expect(err.message).to.contain('Unable to compile TypeScript')
824-
expect(err.message).to.match(new RegExp('TS2345: Argument of type \'(?:number|1101)\' is not assignable to parameter of type \'string\'\\.'))
825-
expect(err.message).to.match(new RegExp('TS2322: Type \'(?:"hello world"|string)\' is not assignable to type \'number\'\\.'))
826-
expect(stdout).to.equal('')
822+
expect(err.message).to.contain('Unable to compile TypeScript')
823+
expect(err.message).to.match(new RegExp('TS2345: Argument of type \'(?:number|1101)\' is not assignable to parameter of type \'string\'\\.'))
824+
expect(err.message).to.match(new RegExp('TS2322: Type \'(?:"hello world"|string)\' is not assignable to type \'number\'\\.'))
825+
expect(stdout).to.equal('')
827826

828-
return done()
829-
})
827+
return done()
830828
})
831829
})
832830
}

0 commit comments

Comments
 (0)