Skip to content

Commit

Permalink
Test custom typeRoots support in tsconfig.json
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Jun 25, 2018
1 parent 6ce7c97 commit c692f94
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,5 +1,4 @@
node_modules/
bower_components/
coverage/
.DS_Store
npm-debug.log
Expand Down
8 changes: 8 additions & 0 deletions src/index.spec.ts
Expand Up @@ -251,6 +251,14 @@ describe('ts-node', function () {
return done()
})
})

it('should allow custom typings', function (done) {
exec(`${BIN_EXEC} tests/custom-types`, function (err, stdout) {
expect(err).to.match(/Error: Cannot find module 'does-not-exist'/)

return done()
})
})
})

describe('register', function () {
Expand Down
3 changes: 3 additions & 0 deletions tests/custom-types.ts
@@ -0,0 +1,3 @@
import { foobar } from 'does-not-exist'

console.log(foobar)
3 changes: 2 additions & 1 deletion tests/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"jsx": "react",
"noEmit": true
"noEmit": true,
"typeRoots": ["./typings", "../node_modules/@types"]
}
}
3 changes: 3 additions & 0 deletions tests/typings/does-not-exist/index.d.ts
@@ -0,0 +1,3 @@
declare module "does-not-exist" {
export const foobar = 'test'
}

0 comments on commit c692f94

Please sign in to comment.