Skip to content

Commit

Permalink
Passes -r ts-node/register argument to node
Browse files Browse the repository at this point in the history
Fixes cross-plaftorm issues.

Close #523
Close #522
  • Loading branch information
fox1t authored and isaacs committed Mar 22, 2019
1 parent 4645ecf commit ad3bed4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const path = require('path')
const exists = require('fs-exists-cached').sync
const os = require('os')
const isTTY = process.stdin.isTTY || process.env._TAP_IS_TTY === '1'
const tsNode = require.resolve(
'ts-node/' + require('ts-node/package.json').bin['ts-node']
)
const tsNode = require.resolve('ts-node/register')

const coverageServiceTest = process.env.COVERAGE_SERVICE_TEST === 'true'

Expand Down Expand Up @@ -751,8 +749,8 @@ const runAllFiles = (options, saved, tap) => {
const args = esmArg.concat(options.nodeArgs).concat(file).concat(options.testArgs)
tap.spawn(node, args, opt, file)
} else if (file.match(/\.ts$/)) {
const args = esmArg.concat(options.nodeArgs).concat(file).concat(options.testArgs)
tap.spawn(tsNode, args, opt, file)
const args = esmArg.concat(['-r', tsNode]).concat(options.nodeArgs).concat(file).concat(options.testArgs)
tap.spawn(node, args, opt, file)
} else if (isexe.sync(options.files[i]))
tap.spawn(options.files[i], options.testArgs, opt, file)
}
Expand Down

0 comments on commit ad3bed4

Please sign in to comment.