Skip to content

Commit 0ea6007

Browse files
committed
Conditionally run esm tests on node >= 13
1 parent 0c31516 commit 0ea6007

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/index.spec.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -635,27 +635,29 @@ describe('ts-node', function () {
635635
})
636636
})
637637

638-
describe('esm', () => {
639-
this.slow(1000)
638+
if (semver.gte(process.version, '13.0.0')) {
639+
describe('esm', () => {
640+
this.slow(1000)
640641

641-
const cmd = `node --loader ../../esm.mjs`
642+
const cmd = `node --loader ../../esm.mjs`
642643

643-
it('should compile and execute as ESM', (done) => {
644-
exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm') }, function (err, stdout) {
645-
expect(err).to.equal(null)
646-
expect(stdout).to.equal('foo bar baz biff\n')
644+
it('should compile and execute as ESM', (done) => {
645+
exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm') }, function (err, stdout) {
646+
expect(err).to.equal(null)
647+
expect(stdout).to.equal('foo bar baz biff\n')
647648

648-
return done()
649+
return done()
650+
})
649651
})
650-
})
651-
it('supports --experimental-specifier-resolution=node', (done) => {
652-
exec(`${cmd} --experimental-specifier-resolution=node index.ts`, { cwd: join(__dirname, '../tests/esm-node-resolver') }, function (err, stdout) {
653-
expect(err).to.equal(null)
654-
expect(stdout).to.equal('foo bar baz biff\n')
652+
it('supports --experimental-specifier-resolution=node', (done) => {
653+
exec(`${cmd} --experimental-specifier-resolution=node index.ts`, { cwd: join(__dirname, '../tests/esm-node-resolver') }, function (err, stdout) {
654+
expect(err).to.equal(null)
655+
expect(stdout).to.equal('foo bar baz biff\n')
655656

656-
return done()
657-
})
657+
return done()
658+
})
658659

660+
})
659661
})
660-
})
662+
}
661663
})

0 commit comments

Comments
 (0)