Skip to content

Commit

Permalink
fix tests on node 10
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Feb 15, 2021
1 parent 9734642 commit e05f037
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.spec.ts
Expand Up @@ -470,8 +470,10 @@ describe('ts-node', function () {
})
})

const preferTsExtsEntrypoint = semver.gte(process.version, '12.0.0') ? 'import-order/compiled' : 'import-order/require-compiled'
it('should import ts before js when --prefer-ts-exts flag is present', function (done) {
exec(`${cmd} --prefer-ts-exts import-order/compiled`, function (err, stdout) {

exec(`${cmd} --prefer-ts-exts ${preferTsExtsEntrypoint}`, function (err, stdout) {
expect(err).to.equal(null)
expect(stdout).to.equal('Hello, TypeScript!\n')

Expand All @@ -480,7 +482,7 @@ describe('ts-node', function () {
})

it('should import ts before js when TS_NODE_PREFER_TS_EXTS env is present', function (done) {
exec(`${cmd} import-order/compiled`, { env: { ...process.env, TS_NODE_PREFER_TS_EXTS: 'true' } }, function (err, stdout) {
exec(`${cmd} ${preferTsExtsEntrypoint}`, { env: { ...process.env, TS_NODE_PREFER_TS_EXTS: 'true' } }, function (err, stdout) {
expect(err).to.equal(null)
expect(stdout).to.equal('Hello, TypeScript!\n')

Expand Down

0 comments on commit e05f037

Please sign in to comment.