@@ -5,7 +5,7 @@ import semver = require('semver')
55import ts = require( 'typescript' )
66import proxyquire = require( 'proxyquire' )
77import { register , create , VERSION } from './index'
8- import { unlinkSync , existsSync } from 'fs'
8+ import { unlinkSync , existsSync , statSync } from 'fs'
99import * as promisify from 'util.promisify'
1010
1111const execP = promisify ( exec )
@@ -262,7 +262,7 @@ describe('ts-node', function () {
262262 } )
263263
264264 it ( 'should pipe into an eval script' , function ( done ) {
265- const cp = exec ( `${ cmd } --transpile-only -pe ' process.stdin.isTTY' ` , function ( err , stdout ) {
265+ const cp = exec ( `${ cmd } --transpile-only -pe " process.stdin.isTTY" ` , function ( err , stdout ) {
266266 expect ( err ) . to . equal ( null )
267267 expect ( stdout ) . to . equal ( 'undefined\n' )
268268
@@ -369,18 +369,23 @@ describe('ts-node', function () {
369369
370370 describe ( 'issue #884' , function ( ) {
371371 it ( 'should compile' , function ( done ) {
372- exec ( `node "${ BIN_PATH } " --project tests/issue-884/tsconfig.json tests/issue-884` , function ( err , stdout ) {
373- expect ( err ) . to . equal ( null )
374- expect ( stdout ) . to . equal ( '' )
372+ // TODO disabled because it consistently fails on Windows on TS 2.7
373+ if ( process . platform === 'win32' && semver . satisfies ( ts . version , '2.7' ) ) {
374+ this . skip ( )
375+ } else {
376+ exec ( `"${ BIN_PATH } " --project tests/issue-884/tsconfig.json tests/issue-884` , function ( err , stdout ) {
377+ expect ( err ) . to . equal ( null )
378+ expect ( stdout ) . to . equal ( '' )
375379
376- return done ( )
377- } )
380+ return done ( )
381+ } )
382+ }
378383 } )
379384 } )
380385
381386 describe ( 'issue #986' , function ( ) {
382387 it ( 'should not compile' , function ( done ) {
383- exec ( `node "${ BIN_PATH } " --project tests/issue-986/tsconfig.json tests/issue-986` , function ( err , stdout , stderr ) {
388+ exec ( `"${ BIN_PATH } " --project tests/issue-986/tsconfig.json tests/issue-986` , function ( err , stdout , stderr ) {
384389 expect ( err ) . not . to . equal ( null )
385390 expect ( stderr ) . to . contain ( 'Cannot find name \'TEST\'' ) // TypeScript error.
386391 expect ( stdout ) . to . equal ( '' )
@@ -390,7 +395,7 @@ describe('ts-node', function () {
390395 } )
391396
392397 it ( 'should compile with `--files`' , function ( done ) {
393- exec ( `node "${ BIN_PATH } " --files --project tests/issue-986/tsconfig.json tests/issue-986` , function ( err , stdout , stderr ) {
398+ exec ( `"${ BIN_PATH } " --files --project tests/issue-986/tsconfig.json tests/issue-986` , function ( err , stdout , stderr ) {
394399 expect ( err ) . not . to . equal ( null )
395400 expect ( stderr ) . to . contain ( 'ReferenceError: TEST is not defined' ) // Runtime error.
396401 expect ( stdout ) . to . equal ( '' )
@@ -402,20 +407,24 @@ describe('ts-node', function () {
402407
403408 if ( semver . gte ( ts . version , '2.7.0' ) ) {
404409 it ( 'should support script mode' , function ( done ) {
405- exec ( `node ${ BIN_SCRIPT_PATH } tests/scope/a/log` , function ( err , stdout ) {
410+ exec ( `${ BIN_SCRIPT_PATH } tests/scope/a/log` , function ( err , stdout ) {
406411 expect ( err ) . to . equal ( null )
407412 expect ( stdout ) . to . equal ( '.ts\n' )
408413
409414 return done ( )
410415 } )
411416 } )
412417 it ( 'should read tsconfig relative to realpath, not symlink, in scriptMode' , function ( done ) {
413- exec ( `node ${ BIN_SCRIPT_PATH } tests/main-realpath/symlink/symlink.tsx` , function ( err , stdout ) {
414- expect ( err ) . to . equal ( null )
415- expect ( stdout ) . to . equal ( '' )
418+ if ( statSync ( join ( TEST_DIR , 'main-realpath/symlink/symlink.tsx' ) ) . isSymbolicLink ( ) ) {
419+ exec ( `${ BIN_SCRIPT_PATH } tests/main-realpath/symlink/symlink.tsx` , function ( err , stdout ) {
420+ expect ( err ) . to . equal ( null )
421+ expect ( stdout ) . to . equal ( '' )
416422
417- return done ( )
418- } )
423+ return done ( )
424+ } )
425+ } else {
426+ this . skip ( )
427+ }
419428 } )
420429 }
421430
@@ -431,7 +440,7 @@ describe('ts-node', function () {
431440 } , function ( err , stdout ) {
432441 expect ( err ) . to . equal ( null )
433442 const { config } = JSON . parse ( stdout )
434- expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/env-typeroots' ) ] )
443+ expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/env-typeroots' ) . replace ( / \\ / g , '/' ) ] )
435444 return done ( )
436445 } )
437446 } )
@@ -440,7 +449,7 @@ describe('ts-node', function () {
440449 exec ( `${ BIN_EXEC } tests/tsconfig-options/log-options.js` , function ( err , stdout ) {
441450 expect ( err ) . to . equal ( null )
442451 const { options, config } = JSON . parse ( stdout )
443- expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/tsconfig-typeroots' ) ] )
452+ expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/tsconfig-typeroots' ) . replace ( / \\ / g , '/' ) ] )
444453 expect ( config . options . types ) . to . deep . equal ( [ 'tsconfig-tsnode-types' ] )
445454 expect ( options . pretty ) . to . equal ( undefined )
446455 expect ( options . skipIgnore ) . to . equal ( false )
@@ -450,10 +459,10 @@ describe('ts-node', function () {
450459 } )
451460
452461 it ( 'should have flags override `tsconfig.json`' , function ( done ) {
453- exec ( `${ BIN_EXEC } --skip-ignore --compiler-options '{ "types": [ "flags-types"]}' tests/tsconfig-options/log-options.js` , function ( err , stdout ) {
462+ exec ( `${ BIN_EXEC } --skip-ignore --compiler-options "{\\ "types\\":[\\ "flags-types\\ "]}" tests/tsconfig-options/log-options.js` , function ( err , stdout ) {
454463 expect ( err ) . to . equal ( null )
455464 const { options, config } = JSON . parse ( stdout )
456- expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/tsconfig-typeroots' ) ] )
465+ expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/tsconfig-typeroots' ) . replace ( / \\ / g , '/' ) ] )
457466 expect ( config . options . types ) . to . deep . equal ( [ 'flags-types' ] )
458467 expect ( options . pretty ) . to . equal ( undefined )
459468 expect ( options . skipIgnore ) . to . equal ( true )
@@ -472,7 +481,7 @@ describe('ts-node', function () {
472481 } , function ( err , stdout ) {
473482 expect ( err ) . to . equal ( null )
474483 const { options, config } = JSON . parse ( stdout )
475- expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/tsconfig-typeroots' ) ] )
484+ expect ( config . options . typeRoots ) . to . deep . equal ( [ join ( __dirname , '../tests/tsconfig-options/tsconfig-typeroots' ) . replace ( / \\ / g , '/' ) ] )
476485 expect ( config . options . types ) . to . deep . equal ( [ 'tsconfig-tsnode-types' ] )
477486 expect ( options . pretty ) . to . equal ( true )
478487 expect ( options . skipIgnore ) . to . equal ( false )
0 commit comments