Skip to content

Commit c692f94

Browse files
committed
Test custom typeRoots support in tsconfig.json
1 parent 6ce7c97 commit c692f94

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules/
2-
bower_components/
32
coverage/
43
.DS_Store
54
npm-debug.log

src/index.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ describe('ts-node', function () {
251251
return done()
252252
})
253253
})
254+
255+
it('should allow custom typings', function (done) {
256+
exec(`${BIN_EXEC} tests/custom-types`, function (err, stdout) {
257+
expect(err).to.match(/Error: Cannot find module 'does-not-exist'/)
258+
259+
return done()
260+
})
261+
})
254262
})
255263

256264
describe('register', function () {

tests/custom-types.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { foobar } from 'does-not-exist'
2+
3+
console.log(foobar)

tests/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"jsx": "react",
4-
"noEmit": true
4+
"noEmit": true,
5+
"typeRoots": ["./typings", "../node_modules/@types"]
56
}
67
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module "does-not-exist" {
2+
export const foobar = 'test'
3+
}

0 commit comments

Comments
 (0)