@@ -370,41 +370,43 @@ describe('ts-node', function () {
370
370
expect ( ( ) => require ( moduleTestPath ) ) . to . not . throw ( )
371
371
} )
372
372
373
- it ( 'should support compiler scopes' , function ( ) {
374
- const calls : string [ ] = [ ]
373
+ if ( semver . gte ( ts . version , '2.7.0' ) ) {
374
+ it ( 'should support compiler scopes' , function ( ) {
375
+ const calls : string [ ] = [ ]
375
376
376
- registered . enabled ( false )
377
+ registered . enabled ( false )
377
378
378
- const compilers = [
379
- register ( { cwd : join ( TEST_DIR , 'scope/a' ) , scope : true } ) ,
380
- register ( { cwd : join ( TEST_DIR , 'scope/b' ) , scope : true } )
381
- ]
379
+ const compilers = [
380
+ register ( { cwd : join ( TEST_DIR , 'scope/a' ) , scope : true } ) ,
381
+ register ( { cwd : join ( TEST_DIR , 'scope/b' ) , scope : true } )
382
+ ]
382
383
383
- compilers . forEach ( c => {
384
- const old = c . compile
385
- c . compile = ( code , fileName , lineOffset ) => {
386
- calls . push ( fileName )
384
+ compilers . forEach ( c => {
385
+ const old = c . compile
386
+ c . compile = ( code , fileName , lineOffset ) => {
387
+ calls . push ( fileName )
387
388
388
- return old ( code , fileName , lineOffset )
389
- }
390
- } )
389
+ return old ( code , fileName , lineOffset )
390
+ }
391
+ } )
391
392
392
- try {
393
- expect ( require ( '../tests/scope/a' ) . ext ) . to . equal ( '.ts' )
394
- expect ( require ( '../tests/scope/b' ) . ext ) . to . equal ( '.ts' )
395
- } finally {
396
- compilers . forEach ( c => c . enabled ( false ) )
397
- }
393
+ try {
394
+ expect ( require ( '../tests/scope/a' ) . ext ) . to . equal ( '.ts' )
395
+ expect ( require ( '../tests/scope/b' ) . ext ) . to . equal ( '.ts' )
396
+ } finally {
397
+ compilers . forEach ( c => c . enabled ( false ) )
398
+ }
398
399
399
- expect ( calls ) . to . deep . equal ( [
400
- join ( TEST_DIR , 'scope/a/index.ts' ) ,
401
- join ( TEST_DIR , 'scope/b/index.ts' )
402
- ] )
400
+ expect ( calls ) . to . deep . equal ( [
401
+ join ( TEST_DIR , 'scope/a/index.ts' ) ,
402
+ join ( TEST_DIR , 'scope/b/index.ts' )
403
+ ] )
403
404
404
- delete require . cache [ moduleTestPath ]
405
+ delete require . cache [ moduleTestPath ]
405
406
406
- expect ( ( ) => require ( moduleTestPath ) ) . to . throw ( )
407
- } )
407
+ expect ( ( ) => require ( moduleTestPath ) ) . to . throw ( )
408
+ } )
409
+ }
408
410
409
411
it ( 'should compile through js and ts' , function ( ) {
410
412
const m = require ( '../tests/complex' )
0 commit comments