Skip to content

Commit

Permalink
Create tsconfig.json for old TypeScript versions (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Oct 31, 2018
1 parent 5ee273e commit d58488b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\+]+=*$/

Expand All @@ -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')
Expand All @@ -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')

Expand Down Expand Up @@ -263,7 +264,7 @@ describe('ts-node', function () {

describe('register', function () {
register({
project: join(testDir, 'tsconfig.json'),
project: PROJECT,
compilerOptions: {
jsx: 'preserve'
}
Expand Down
5 changes: 2 additions & 3 deletions tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"compilerOptions": {
"jsx": "react",
"noEmit": true,
// Global type definitions.
"typeRoots": [
"./typings",
"../node_modules/@types",
],
"../node_modules/@types"
]
}
}
11 changes: 11 additions & 0 deletions tests/tsconfig.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"jsx": "react",
"noEmit": true,
// Global type definitions.
"typeRoots": [
"./typings",
"../node_modules/@types",
],
}
}

0 comments on commit d58488b

Please sign in to comment.