diff --git a/src/index.spec.ts b/src/index.spec.ts index 2f7b78337..d350f7e25 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -635,27 +635,29 @@ describe('ts-node', function () { }) }) - describe('esm', () => { - this.slow(1000) + if (semver.gte(process.version, '13.0.0') { + describe('esm', () => { + this.slow(1000) - const cmd = `node --loader ../../esm.mjs` + const cmd = `node --loader ../../esm.mjs` - it('should compile and execute as ESM', (done) => { - exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm') }, function (err, stdout) { - expect(err).to.equal(null) - expect(stdout).to.equal('foo bar baz biff\n') + it('should compile and execute as ESM', (done) => { + exec(`${cmd} index.ts`, { cwd: join(__dirname, '../tests/esm') }, function (err, stdout) { + expect(err).to.equal(null) + expect(stdout).to.equal('foo bar baz biff\n') - return done() + return done() + }) }) - }) - it('supports --experimental-specifier-resolution=node', (done) => { - exec(`${cmd} --experimental-specifier-resolution=node index.ts`, { cwd: join(__dirname, '../tests/esm-node-resolver') }, function (err, stdout) { - expect(err).to.equal(null) - expect(stdout).to.equal('foo bar baz biff\n') + it('supports --experimental-specifier-resolution=node', (done) => { + exec(`${cmd} --experimental-specifier-resolution=node index.ts`, { cwd: join(__dirname, '../tests/esm-node-resolver') }, function (err, stdout) { + expect(err).to.equal(null) + expect(stdout).to.equal('foo bar baz biff\n') - return done() - }) + return done() + }) + }) }) - }) + } })