Skip to content

Commit

Permalink
Boolean flags inherit from env (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey authored Jul 4, 2017
1 parent 82effb2 commit 394ddb8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/_bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ const argv = minimist<Argv>(process.argv.slice(2, stop), {
boolean: booleans,
alias: aliases,
default: {
cache: true
cache: null,
fast: null,
disableWarnings: null
}
})

Expand Down
19 changes: 19 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ describe('ts-node', function () {
)
})

it('should be able to disable warnings from environment', function (done) {
exec(
`${BIN_EXEC} tests/compiler-error`,
{
env: {
PATH: process.env.PATH,
TS_NODE_DISABLE_WARNINGS: true
}
},
function (err) {
expect(err.message).to.match(
/TypeError: (?:(?:undefined|str\.toUpperCase) is not a function|.*has no method \'toUpperCase\')/
)

return done()
}
)
})

it('should work with source maps', function (done) {
exec(`${BIN_EXEC} tests/throw`, function (err) {
expect(err.message).to.contain([
Expand Down
5 changes: 5 additions & 0 deletions tests/compiler-error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function upper (str: string) {
return str.toUpperCase()
}

upper(10)

0 comments on commit 394ddb8

Please sign in to comment.