Skip to content

Commit cd656a4

Browse files
committed
fix tests
1 parent 9f4deca commit cd656a4

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"scripts": {
4040
"ts-node-dev": "node ./bin/ts-node-dev",
4141
"tsnd": "yarn ts-node-dev",
42-
"test": "ts-node --transpile-only test/index.ts",
43-
"test-dev": "ts-node-dev --respawn --transpile-only test/index.ts",
42+
"test": "ts-node -T test/index.ts",
43+
"test-dev": "ts-node-dev --respawn -T test/index.ts",
4444
"test-docker": "docker-compose up",
4545
"ci": "yarn test",
4646
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",

test/index.ts

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -157,36 +157,22 @@ test('It handles resolveJsonModule option and loads JSON modules', async (t) =>
157157

158158
test('It should not allow --script-mode and --dir together', async (t) => {
159159
const ps = spawnTsNodeDev(
160-
[
161-
`--script-mode`,
162-
`--dir folder`,
163-
`simple.ts`,
164-
].join(' ')
165-
)//.turnOnOutput()
160+
[`--script-mode`, `--dir folder`, `simple.ts`].join(' ')
161+
) //.turnOnOutput()
166162
await ps.waitForLine(/TypeError: Script mode cannot be combined with `--dir`/)
167163
t.pass('ok')
168164
await ps.exit()
169165
})
170166

171167
test('It should use the tsconfig at --dir when defined', async (t) => {
172-
const ps = spawnTsNodeDev(
173-
[
174-
`--dir dir-test`,
175-
`dir-test/index.ts`,
176-
].join(' ')
177-
)//.turnOnOutput()
168+
const ps = spawnTsNodeDev([`--dir dir-test`, `dir-test/index.ts`].join(' ')) //.turnOnOutput()
178169
await ps.waitForLine(/\{ hello: 'world' \}/)
179170
t.pass('ok')
180171
await ps.exit()
181172
})
182173

183174
test('It should use the tsconfig at --script-mode when defined', async (t) => {
184-
const ps = spawnTsNodeDev(
185-
[
186-
`-s`,
187-
`dir-test/index.ts`,
188-
].join(' ')
189-
)//.turnOnOutput()
175+
const ps = spawnTsNodeDev([`-s`, `dir-test/index.ts`].join(' ')) //.turnOnOutput()
190176
await ps.waitForLine(/\{ hello: 'world' \}/)
191177
t.pass('ok')
192178
await ps.exit()
@@ -199,14 +185,12 @@ test('It should fail if not using --dir or --script-mode on dir-test/index.ts',
199185
`--compiler-options=${JSON.stringify(cOptions)}`,
200186
`dir-test/index.ts`,
201187
].join(' ')
202-
).turnOnOutput()
188+
)//.turnOnOutput()
203189
await ps.waitForLine(/has no default export./)
204190
t.pass('ok')
205191
await ps.exit()
206192
})
207193

208-
209-
210194
test('It allows to use TS Transformers', async (t) => {
211195
const cOptions = { plugins: [{ transform: 'ts-nameof', type: 'raw' }] }
212196
const ps = spawnTsNodeDev(
@@ -301,8 +285,8 @@ test.skip('It should add require with -r flag', async (t) => {
301285
t.end()
302286
})
303287

304-
test.only('It should handle --deps flag', async (t) => {
305-
const ps = spawnTsNodeDev([`--deps`, `--respawn`, `req-package`].join(' ')).turnOnOutput()
288+
test('It should handle --deps flag', async (t) => {
289+
const ps = spawnTsNodeDev([`--deps`, `--respawn`, `req-package`].join(' ')) //.turnOnOutput()
306290

307291
await ps.waitForLine(/PACKAGE/)
308292

@@ -313,10 +297,11 @@ test.only('It should handle --deps flag', async (t) => {
313297
'PACKAGE',
314298
'CHANGED PACKAGE'
315299
),
316-
250
300+
100
317301
)
318302

319303
await ps.waitForLine(/CHANGED PACKAGE/)
304+
await ps.exit()
320305
t.pass()
321306
t.end()
322307
})

0 commit comments

Comments
 (0)