Skip to content

Commit 09f673f

Browse files
committed
tests
1 parent 063066c commit 09f673f

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.0'
2+
volumes:
3+
node10modules: null
4+
node14modules: null
5+
services:
6+
node10:
7+
image: node:10.21.0-jessie-slim
8+
working_dir: /package
9+
command: sh -c "yarn --frozen-lockfile && yarn test"
10+
volumes:
11+
- ./:/package
12+
- node10modules:/package/node_modules
13+
14+
node14:
15+
image: node:14-stretch-slim
16+
working_dir: /package
17+
command: sh -c "yarn --frozen-lockfile && yarn test"
18+
volumes:
19+
- ./:/package
20+
- node14modules:/package/node_modules

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"tsnd": "yarn ts-node-dev",
4242
"test": "ts-node --transpile-only test/index.ts",
4343
"ci": "yarn test",
44+
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",
4445
"manual": "node ./bin/ts-node-dev --rt 5 --exit-child --tree-kill --clear -r tsconfig-paths/register -r ./test/manual/add-require -r ./test/manual/add-require-2 -r esm -O \"{\\\"module\\\": \\\"es6\\\"}\" --preserve-symlinks --respawn --ignore-watch 'lib' --ignore-watch bin --prefer-ts --debug --poll --interval 1000 --cache-directory .ts-node --inspect -- test/manual/test-script test-arg --fd"
4546
},
4647
"dependencies": {

test/fixture/uncaught-handler.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
process.on('uncaughtException', function (e) {
2+
setTimeout(function () {
3+
console.log('async', e);
4+
}, 100);
5+
});
6+
7+
//const foo = () => {console.log('s')}
8+
9+
// eslint-disable-next-line no-undef
10+
foo(); // undefined / throws exception

test/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test('It should report an error on start', async (t) => {
9595
await replaceText('with-error.ts', '1', `'1'`)
9696
})
9797

98-
test.only('It should restart on adding not imported module', async (t) => {
98+
test('It should restart on adding not imported module', async (t) => {
9999
const ps = spawnTsNodeDev('--respawn with-error.ts', {
100100
// stdout: true,
101101
env: {

test/spawn.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export const spawnTsNodeDev = (
88
opts: { stdout?: boolean; stderr?: boolean; env?: any } = {}
99
) => {
1010
const nodeArg = [bin].concat(cmd.split(' '))
11-
const ps = child.spawn('node', nodeArg, { cwd: scriptsDir, env: opts.env })
11+
const ps = child.spawn('node', nodeArg, { cwd: scriptsDir, env: {
12+
...process.env,
13+
...opts.env
14+
} })
1215
var out = ''
1316
var err = ''
1417

0 commit comments

Comments
 (0)