Skip to content

Commit

Permalink
Add test covering --files flag (#987)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Mar 22, 2020
1 parent 0c0bc3d commit 366ac0b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
34 changes: 29 additions & 5 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,36 @@ describe('ts-node', function () {
})
})

it('issue #884', function (done) {
exec(`node "${BIN_PATH}" --project tests/issue-884/tsconfig.json tests/issue-884`, function (err, stdout) {
expect(err).to.equal(null)
expect(stdout).to.equal('')
describe('issue #884', function () {
it('should compile', function (done) {
exec(`node "${BIN_PATH}" --project tests/issue-884/tsconfig.json tests/issue-884`, function (err, stdout) {
expect(err).to.equal(null)
expect(stdout).to.equal('')

return done()
return done()
})
})
})

describe('issue #986', function () {
it('should not compile', function (done) {
exec(`node "${BIN_PATH}" --project tests/issue-986/tsconfig.json tests/issue-986`, function (err, stdout, stderr) {
expect(err).not.to.equal(null)
expect(stderr).to.contain('Cannot find name \'TEST\'') // TypeScript error.
expect(stdout).to.equal('')

return done()
})
})

it('should compile with `--files`', function (done) {
exec(`node "${BIN_PATH}" --files --project tests/issue-986/tsconfig.json tests/issue-986`, function (err, stdout, stderr) {
expect(err).not.to.equal(null)
expect(stderr).to.contain('ReferenceError: TEST is not defined') // Runtime error.
expect(stdout).to.equal('')

return done()
})
})
})

Expand Down
1 change: 1 addition & 0 deletions tests/issue-986/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(TEST)
5 changes: 5 additions & 0 deletions tests/issue-986/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"module": "CommonJS"
}
}
1 change: 1 addition & 0 deletions tests/issue-986/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const TEST: string

0 comments on commit 366ac0b

Please sign in to comment.