Skip to content

Commit bcbab3c

Browse files
committed
add --deps test
1 parent 62b8f12 commit bcbab3c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

test/fixture/req-package.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('package')

test/index.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test('It should restart on file change', async (t) => {
4444
})
4545

4646
test('It allow watch arbitrary folder/file', async (t) => {
47-
const ps = spawnTsNodeDev('--respawn --watch folder,folder2 simple.ts')//.turnOnOutput()
47+
const ps = spawnTsNodeDev('--respawn --watch folder,folder2 simple.ts') //.turnOnOutput()
4848
await ps.waitForLine(/Using/)
4949
setTimeout(() => touch(join(scriptsDir, 'folder/some-file')), 250)
5050
await ps.waitForLine(/Restarting.*some-file/)
@@ -149,7 +149,7 @@ test('It handles resolveJsonModule option and loads JSON modules', async (t) =>
149149
`--compiler-options=${JSON.stringify(cOptions)}`,
150150
`import-json`,
151151
].join(' ')
152-
)//.turnOnOutput()
152+
) //.turnOnOutput()
153153
await ps.waitForLine(/JSON DATA: { file: 'json' }/)
154154
t.pass('ok')
155155
await ps.exit()
@@ -237,7 +237,7 @@ test.skip('It should add require with -r flag', async (t) => {
237237
//`--debug`,
238238
`simple`,
239239
].join(' ')
240-
).turnOnOutput()
240+
) //.turnOnOutput()
241241
await ps.waitForLine(/added --require/)
242242
await ps.waitForLine(/v1/)
243243

@@ -248,3 +248,23 @@ test.skip('It should add require with -r flag', async (t) => {
248248
t.pass()
249249
t.end()
250250
})
251+
252+
test.only('It should handle --deps flag', async (t) => {
253+
const ps = spawnTsNodeDev([`--deps`, `--respawn`, `req-package`].join(' ')).turnOnOutput()
254+
255+
await ps.waitForLine(/PACKAGE/)
256+
257+
setTimeout(
258+
() =>
259+
replaceText(
260+
'node_modules/package/index.js',
261+
'PACKAGE',
262+
'CHANGED PACKAGE'
263+
),
264+
250
265+
)
266+
267+
await ps.waitForLine(/CHANGED PACKAGE/)
268+
t.pass()
269+
t.end()
270+
})

0 commit comments

Comments
 (0)