@@ -11,7 +11,7 @@ import { tmpdir } from 'os';
1111import semver = require( 'semver' ) ;
1212import ts = require( 'typescript' ) ;
1313import proxyquire = require( 'proxyquire' ) ;
14- import type * as tsNodeTypes from './index' ;
14+ import type * as tsNodeTypes from '.. /index' ;
1515import * as fs from 'fs' ;
1616import {
1717 unlinkSync ,
@@ -64,8 +64,9 @@ function exec(
6464 ) ;
6565}
6666
67- const ROOT_DIR = resolve ( __dirname , '..' ) ;
68- const TEST_DIR = join ( __dirname , '../tests' ) ;
67+ const ROOT_DIR = resolve ( __dirname , '../..' ) ;
68+ const DIST_DIR = resolve ( __dirname , '..' ) ;
69+ const TEST_DIR = join ( __dirname , '../../tests' ) ;
6970const PROJECT = join ( TEST_DIR , 'tsconfig.json' ) ;
7071const BIN_PATH = join ( TEST_DIR , 'node_modules/.bin/ts-node' ) ;
7172const BIN_SCRIPT_PATH = join ( TEST_DIR , 'node_modules/.bin/ts-node-script' ) ;
@@ -93,7 +94,7 @@ test.suite('ts-node', (test) => {
9394 const cmdNoProject = `"${ BIN_PATH } "` ;
9495
9596 test ( 'should export the correct version' , ( ) => {
96- expect ( VERSION ) . to . equal ( require ( '../package.json' ) . version ) ;
97+ expect ( VERSION ) . to . equal ( require ( '../../ package.json' ) . version ) ;
9798 } ) ;
9899 test ( 'should export all CJS entrypoints' , ( ) => {
99100 // Ensure our package.json "exports" declaration allows `require()`ing all our entrypoints
@@ -900,7 +901,7 @@ test.suite('ts-node', (test) => {
900901 jsx : 'preserve' ,
901902 } ,
902903 } ) ,
903- moduleTestPath : require . resolve ( '../tests/module' ) ,
904+ moduleTestPath : require . resolve ( '../../ tests/module' ) ,
904905 } ;
905906 } )
906907 ) ;
@@ -973,8 +974,8 @@ test.suite('ts-node', (test) => {
973974 } ) ;
974975
975976 try {
976- expect ( require ( '../tests/scope/a' ) . ext ) . to . equal ( '.ts' ) ;
977- expect ( require ( '../tests/scope/b' ) . ext ) . to . equal ( '.ts' ) ;
977+ expect ( require ( '../../ tests/scope/a' ) . ext ) . to . equal ( '.ts' ) ;
978+ expect ( require ( '../../ tests/scope/b' ) . ext ) . to . equal ( '.ts' ) ;
978979 } finally {
979980 compilers . forEach ( ( c ) => c . enabled ( false ) ) ;
980981 }
@@ -991,28 +992,28 @@ test.suite('ts-node', (test) => {
991992 }
992993
993994 test ( 'should compile through js and ts' , ( ) => {
994- const m = require ( '../tests/complex' ) ;
995+ const m = require ( '../../ tests/complex' ) ;
995996
996997 expect ( m . example ( ) ) . to . equal ( 'example' ) ;
997998 } ) ;
998999
9991000 test ( 'should work with proxyquire' , ( ) => {
1000- const m = proxyquire ( '../tests/complex' , {
1001+ const m = proxyquire ( '../../ tests/complex' , {
10011002 './example' : 'hello' ,
10021003 } ) ;
10031004
10041005 expect ( m . example ( ) ) . to . equal ( 'hello' ) ;
10051006 } ) ;
10061007
10071008 test ( 'should work with `require.cache`' , ( ) => {
1008- const { example1, example2 } = require ( '../tests/require-cache' ) ;
1009+ const { example1, example2 } = require ( '../../ tests/require-cache' ) ;
10091010
10101011 expect ( example1 ) . to . not . equal ( example2 ) ;
10111012 } ) ;
10121013
10131014 test ( 'should use source maps' , async ( ) => {
10141015 try {
1015- require ( '../tests/throw' ) ;
1016+ require ( '../../ tests/throw' ) ;
10161017 } catch ( error ) {
10171018 expect ( error . stack ) . to . contain (
10181019 [
@@ -1047,7 +1048,7 @@ test.suite('ts-node', (test) => {
10471048 require . extensions [ '.tsx' ] = old ;
10481049 } ) ;
10491050 try {
1050- require ( '../tests/with-jsx.tsx' ) ;
1051+ require ( '../../ tests/with-jsx.tsx' ) ;
10511052 } catch ( error ) {
10521053 expect ( error . stack ) . to . contain ( 'SyntaxError: Unexpected token' ) ;
10531054 }
@@ -1103,13 +1104,13 @@ test.suite('ts-node', (test) => {
11031104 disallowed : string [ ]
11041105 ) {
11051106 for ( const ext of allowed ) {
1106- expect ( ignored ( join ( __dirname , `index${ ext } ` ) ) ) . equal (
1107+ expect ( ignored ( join ( DIST_DIR , `index${ ext } ` ) ) ) . equal (
11071108 false ,
11081109 `should accept ${ ext } files`
11091110 ) ;
11101111 }
11111112 for ( const ext of disallowed ) {
1112- expect ( ignored ( join ( __dirname , `index${ ext } ` ) ) ) . equal (
1113+ expect ( ignored ( join ( DIST_DIR , `index${ ext } ` ) ) ) . equal (
11131114 true ,
11141115 `should ignore ${ ext } files`
11151116 ) ;
0 commit comments