From 0ea60074b2746c8e705244169e0375f28caf875f Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sat, 2 May 2020 20:13:23 -0400 Subject: [PATCH] Conditionally run esm tests on node >= 13 --- src/index.spec.ts | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/index.spec.ts b/src/index.spec.ts index 2f7b78337..51f4d2b61 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() + }) + }) }) - }) + } })