Skip to content

Commit

Permalink
Conditionally run esm tests on node >= 13
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed May 3, 2020
1 parent 0c31516 commit d133792
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

})
})
})
}
})

0 comments on commit d133792

Please sign in to comment.