diff --git a/package-lock.json b/package-lock.json index 0461bf7bc..73f73f28e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1173,9 +1173,9 @@ "dev": true }, "typescript": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.1.tgz", - "integrity": "sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.5.tgz", + "integrity": "sha512-muYNWV9j5+3mXoKD6oPONKuGUmYiFX14gfo9lWm9ZXRHOqVDQiB4q1CzFPbF4QLV2E9TZXH6oK55oQ94rn3PpA==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index d3d5eac27..9585ceca3 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "semver": "^5.1.0", "tslint": "^5.11.0", "tslint-config-standard": "^8.0.1", - "typescript": "^3.1.1" + "typescript": "^3.1.5" }, "peerDependencies": { "typescript": ">=2.0" diff --git a/src/index.spec.ts b/src/index.spec.ts index db422c870..1803ed306 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -6,9 +6,10 @@ import ts = require('typescript') import proxyquire = require('proxyquire') import { register, VERSION } from './index' -const testDir = join(__dirname, '../tests') +const TEST_DIR = join(__dirname, '../tests') const EXEC_PATH = join(__dirname, '../dist/bin') -const BIN_EXEC = `node "${EXEC_PATH}" --project "${testDir}/tsconfig.json"` +const PROJECT = join(TEST_DIR, semver.gte(ts.version, '2.5.0') ? 'tsconfig.json5' : 'tsconfig.json') +const BIN_EXEC = `node "${EXEC_PATH}" --project "${PROJECT}"` const SOURCE_MAP_REGEXP = /\/\/# sourceMappingURL=data:application\/json;charset=utf\-8;base64,[\w\+]+=*$/ @@ -33,7 +34,7 @@ describe('ts-node', function () { it('should register via cli', function (done) { exec(`node -r ../register hello-world.ts`, { - cwd: testDir + cwd: TEST_DIR }, function (err, stdout) { expect(err).to.equal(null) expect(stdout).to.equal('Hello, world!\n') @@ -43,7 +44,7 @@ describe('ts-node', function () { }) it('should execute cli with absolute path', function (done) { - exec(`${BIN_EXEC} "${join(testDir, 'hello-world')}"`, function (err, stdout) { + exec(`${BIN_EXEC} "${join(TEST_DIR, 'hello-world')}"`, function (err, stdout) { expect(err).to.equal(null) expect(stdout).to.equal('Hello, world!\n') @@ -263,7 +264,7 @@ describe('ts-node', function () { describe('register', function () { register({ - project: join(testDir, 'tsconfig.json'), + project: PROJECT, compilerOptions: { jsx: 'preserve' } diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 12fb856f1..526a7e0bf 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -2,10 +2,9 @@ "compilerOptions": { "jsx": "react", "noEmit": true, - // Global type definitions. "typeRoots": [ "./typings", - "../node_modules/@types", - ], + "../node_modules/@types" + ] } } diff --git a/tests/tsconfig.json5 b/tests/tsconfig.json5 new file mode 100644 index 000000000..12fb856f1 --- /dev/null +++ b/tests/tsconfig.json5 @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "jsx": "react", + "noEmit": true, + // Global type definitions. + "typeRoots": [ + "./typings", + "../node_modules/@types", + ], + } +}