Skip to content

Commit 2814501

Browse files
committed
v6.7.0 / 2021-04-07
1 parent 743381f commit 2814501

7 files changed

Lines changed: 78 additions & 68 deletions

File tree

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
./node_modules/.bin/lint-staged

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# node-dev
22

3+
## v6.7.0 / 2021-04-07
4+
5+
- [New Option] `--debounce` to control how long to wait before restarting
6+
- [New Option] `--interval` to adjust the polling interval when enabled
7+
- [`test`] Stop using `tap` aliases
8+
- [`husky`] Migrate from `v4` to `v6`
9+
- [dependencies] Update `semver` from `v7.3.4` to `v7.3.5`
10+
- [devDependencies] Update `@types/node`, `eslint`, `husky`, & `tap`
11+
312
## v6.6.0 / 2021-03-23
413

514
- `--clear` now clears the screen on first start

package.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-dev",
3-
"version": "6.6.0",
3+
"version": "6.7.0",
44
"description": "Restarts your app when files are modified",
55
"keywords": [
66
"restart",
@@ -28,7 +28,8 @@
2828
},
2929
"scripts": {
3030
"lint": "eslint lib test bin/node-dev",
31-
"test": "node test"
31+
"test": "node test",
32+
"prepare": "husky install"
3233
},
3334
"dependencies": {
3435
"dateformat": "^3.0.3",
@@ -37,25 +38,20 @@
3738
"minimist": "^1.1.3",
3839
"node-notifier": "^8.0.1",
3940
"resolve": "^1.0.0",
40-
"semver": "^7.3.4"
41+
"semver": "^7.3.5"
4142
},
4243
"devDependencies": {
43-
"@types/node": "^14.14.31",
44-
"eslint": "^7.20.0",
44+
"@types/node": "^14.14.37",
45+
"eslint": "^7.23.0",
4546
"eslint-plugin-import": "^2.22.1",
46-
"husky": "^4.3.8",
47+
"husky": "^6.0.0",
4748
"lint-staged": "^10.5.4",
4849
"prettier": "^2.2.1",
49-
"tap": "^14.11.0",
50+
"tap": "^15.0.2",
5051
"touch": "^3.1.0",
5152
"ts-node": "^9.1.1",
5253
"typescript": "^4.1.5"
5354
},
54-
"husky": {
55-
"hooks": {
56-
"pre-commit": "lint-staged"
57-
}
58-
},
5955
"lint-staged": {
6056
"*.js": "eslint --cache --fix",
6157
"*.{js,md}": "prettier --write"

test/cli.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,135 +7,135 @@ tap.test('notify is enabled by default', t => {
77
opts: { notify }
88
} = cli(['node', 'bin/node-dev', 'test']);
99

10-
t.is(notify, true);
11-
t.done();
10+
t.equal(notify, true);
11+
t.end();
1212
});
1313

1414
tap.test('--no-notify', t => {
1515
const {
1616
opts: { notify }
1717
} = cli(['node', 'bin/node-dev', '--no-notify', 'test']);
1818

19-
t.is(notify, false);
20-
t.done();
19+
t.equal(notify, false);
20+
t.end();
2121
});
2222

2323
tap.test('--notify=false', t => {
2424
const {
2525
opts: { notify }
2626
} = cli(['node', 'bin/node-dev', '--notify=false', 'test']);
2727

28-
t.is(notify, false);
29-
t.done();
28+
t.equal(notify, false);
29+
t.end();
3030
});
3131

3232
tap.test('--notify', t => {
3333
const {
3434
opts: { notify }
3535
} = cli(['node', 'bin/node-dev', '--notify', 'test']);
3636

37-
t.is(notify, true);
38-
t.done();
37+
t.equal(notify, true);
38+
t.end();
3939
});
4040

4141
tap.test('--notify=true', t => {
4242
const {
4343
opts: { notify }
4444
} = cli(['node', 'bin/node-dev', '--notify=true', 'test']);
4545

46-
t.is(notify, true);
47-
t.done();
46+
t.equal(notify, true);
47+
t.end();
4848
});
4949

5050
tap.test('notify can be disabled by .node-dev.json', t => {
5151
const {
5252
opts: { notify }
5353
} = cli(['node', 'bin/node-dev', 'test/fixture/server.js']);
5454

55-
t.is(notify, false);
56-
t.done();
55+
t.equal(notify, false);
56+
t.end();
5757
});
5858

5959
tap.test('cli overrides .node-dev.json from false to true', t => {
6060
const {
6161
opts: { notify }
6262
} = cli(['node', 'bin/node-dev', '--notify=true', 'test/fixture/server.js']);
6363

64-
t.is(notify, true);
65-
t.done();
64+
t.equal(notify, true);
65+
t.end();
6666
});
6767

6868
tap.test('-r ts-node/register --inspect test/fixture/server.js', t => {
6969
const argv = 'node bin/node-dev -r ts-node/register --inspect test/fixture/server.js'.split(' ');
7070
const { nodeArgs } = cli(argv);
71-
t.deepEqual(nodeArgs, ['-r', 'ts-node/register', '--inspect']);
72-
t.done();
71+
t.same(nodeArgs, ['-r', 'ts-node/register', '--inspect']);
72+
t.end();
7373
});
7474

7575
tap.test('--inspect -r ts-node/register test/fixture/server.js', t => {
7676
const argv = 'node bin/node-dev --inspect -r ts-node/register test/fixture/server.js'.split(' ');
7777
const { nodeArgs } = cli(argv);
78-
t.deepEqual(nodeArgs, ['--inspect', '-r', 'ts-node/register']);
79-
t.done();
78+
t.same(nodeArgs, ['--inspect', '-r', 'ts-node/register']);
79+
t.end();
8080
});
8181

8282
tap.test('--expose_gc gc.js foo', t => {
8383
const argv = 'node bin/node-dev --expose_gc test/fixture/gc.js test/fixture/foo'.split(' ');
8484
const { nodeArgs } = cli(argv);
85-
t.deepEqual(nodeArgs, ['--expose_gc']);
86-
t.done();
85+
t.same(nodeArgs, ['--expose_gc']);
86+
t.end();
8787
});
8888

8989
tap.test('clear is not enabled by default', t => {
9090
const {
9191
opts: { clear }
9292
} = cli(['node', 'bin/node-dev', 'test']);
9393

94-
t.false(clear);
95-
t.done();
94+
t.notOk(clear);
95+
t.end();
9696
});
9797

9898
tap.test('--clear enables clear', t => {
9999
const {
100100
opts: { clear }
101101
} = cli(['node', 'bin/node-dev', '--clear', 'test']);
102102

103-
t.true(clear);
104-
t.done();
103+
t.ok(clear);
104+
t.end();
105105
});
106106

107107
tap.test('interval default', t => {
108108
const {
109109
opts: { interval }
110110
} = cli(['node', 'bin/node-dev', 'test']);
111111

112-
t.is(interval, 1000);
113-
t.done();
112+
t.equal(interval, 1000);
113+
t.end();
114114
});
115115

116116
tap.test('--interval=2000', t => {
117117
const {
118118
opts: { interval }
119119
} = cli(['node', 'bin/node-dev', '--interval=2000', 'test']);
120120

121-
t.is(interval, 2000);
122-
t.done();
121+
t.equal(interval, 2000);
122+
t.end();
123123
});
124124

125125
tap.test('debounce default', t => {
126126
const {
127127
opts: { debounce }
128128
} = cli(['node', 'bin/node-dev', 'test']);
129129

130-
t.is(debounce, 10);
131-
t.done();
130+
t.equal(debounce, 10);
131+
t.end();
132132
});
133133

134134
tap.test('--debounce=2000', t => {
135135
const {
136136
opts: { debounce }
137137
} = cli(['node', 'bin/node-dev', '--debounce=2000', 'test']);
138138

139-
t.is(debounce, 2000);
140-
t.done();
139+
t.equal(debounce, 2000);
140+
t.end();
141141
});

test/log.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ const noColorCfg = { ...defaultConfig, noColor: true };
77

88
tap.test('log.info', t => {
99
const log = logFactory(noColorCfg);
10-
t.like(log.info('hello'), /\[INFO\] \d{2}:\d{2}:\d{2} hello/);
11-
t.done();
10+
t.match(log.info('hello'), /\[INFO\] \d{2}:\d{2}:\d{2} hello/);
11+
t.end();
1212
});
1313

1414
tap.test('log.warn', t => {
1515
const log = logFactory(noColorCfg);
16-
t.like(log.warn('a warning'), /\[WARN\] \d{2}:\d{2}:\d{2} a warning/);
17-
t.done();
16+
t.match(log.warn('a warning'), /\[WARN\] \d{2}:\d{2}:\d{2} a warning/);
17+
t.end();
1818
});
1919

2020
tap.test('log.error', t => {
2121
const log = logFactory(noColorCfg);
22-
t.like(log.error('an error'), /\[ERROR\] \d{2}:\d{2}:\d{2} an error/);
23-
t.done();
22+
t.match(log.error('an error'), /\[ERROR\] \d{2}:\d{2}:\d{2} an error/);
23+
t.end();
2424
});
2525

2626
tap.test('Disable the timestamp', t => {
2727
const log = logFactory({ ...noColorCfg, timestamp: false });
28-
t.like(log.info('no timestamp'), /\[INFO\] no timestamp/);
29-
t.done();
28+
t.match(log.info('no timestamp'), /\[INFO\] no timestamp/);
29+
t.end();
3030
});
3131

3232
tap.test('Custom timestamp', t => {
3333
const log = logFactory({ ...noColorCfg, timestamp: 'yyyy-mm-dd HH:MM:ss' });
34-
t.like(log.error('an error'), /\[ERROR\] \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} an error/);
35-
t.done();
34+
t.match(log.error('an error'), /\[ERROR\] \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} an error/);
35+
t.end();
3636
});

test/spawn/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const touchFile = require('../utils/touch-file');
66

77
tap.test('should pass unknown args to node binary', t => {
88
spawn('--expose_gc gc.js foo', out => {
9-
t.is(out.trim(), 'foo function');
9+
t.equal(out.trim(), 'foo function');
1010
return { exit: t.end.bind(t) };
1111
});
1212
});
@@ -79,39 +79,39 @@ tap.test('should run async code un uncaughtException handlers', t => {
7979

8080
tap.test('should ignore caught errors', t => {
8181
spawn('catch-no-such-module.js', out => {
82-
t.like(out, /Caught/);
82+
t.match(out, /Caught/);
8383
return { exit: t.end.bind(t) };
8484
});
8585
});
8686

8787
tap.test('should not show up in argv', t => {
8888
spawn('argv.js foo', out => {
8989
const argv = JSON.parse(out.replace(/'/g, '"'));
90-
t.like(argv[0], /.*?node(js|\.exe)?$/);
91-
t.is(argv[1], 'argv.js');
92-
t.is(argv[2], 'foo');
90+
t.match(argv[0], /.*?node(js|\.exe)?$/);
91+
t.equal(argv[1], 'argv.js');
92+
t.equal(argv[2], 'foo');
9393
return { exit: t.end.bind(t) };
9494
});
9595
});
9696

9797
tap.test('should pass through the exit code', t => {
9898
spawn('exit.js').on('exit', code => {
99-
t.is(code, 101);
99+
t.equal(code, 101);
100100
t.end();
101101
});
102102
});
103103

104104
tap.test('should conceal the wrapper', t => {
105105
// require.main should be main.js not wrap.js!
106106
spawn('main.js').on('exit', code => {
107-
t.is(code, 0);
107+
t.equal(code, 0);
108108
t.end();
109109
});
110110
});
111111

112112
tap.test('should relay stdin', t => {
113113
const p = spawn('echo.js', out => {
114-
t.is(out, 'foo');
114+
t.equal(out, 'foo');
115115
return { exit: t.end.bind(t) };
116116
});
117117
p.stdin.write('foo');
@@ -160,7 +160,7 @@ tap.test('should kill the forked processes', t => {
160160

161161
tap.test('should *not* set NODE_ENV', t => {
162162
spawn('env.js', out => {
163-
t.notLike(out, /development/);
163+
t.notMatch(out, /development/);
164164
return { exit: t.end.bind(t) };
165165
});
166166
});
@@ -211,7 +211,7 @@ tap.test('Logs timestamp by default', t => {
211211
touchFile('message.js');
212212
return out2 => {
213213
if (out2.match(/Restarting/)) {
214-
t.like(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
214+
t.match(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
215215
return { exit: t.end.bind(t) };
216216
}
217217
};
@@ -225,7 +225,7 @@ tap.test('Supports require from the command-line (ts-node/register)', t => {
225225
touchFile('message.js');
226226
return out2 => {
227227
if (out2.match(/Restarting/)) {
228-
t.like(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
228+
t.match(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
229229
return { exit: t.end.bind(t) };
230230
}
231231
};
@@ -239,7 +239,7 @@ tap.test('Uses ts-node/register for .ts files through config file (also the defa
239239
touchFile('message.js');
240240
return out2 => {
241241
if (out2.match(/Restarting/)) {
242-
t.like(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
242+
t.match(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
243243
return { exit: t.end.bind(t) };
244244
}
245245
};
@@ -253,7 +253,7 @@ tap.test('Supports ECMAScript modules', t => {
253253
touchFile('message.mjs');
254254
return out2 => {
255255
if (out2.match(/Restarting/)) {
256-
t.like(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
256+
t.match(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
257257
return { exit: t.end.bind(t) };
258258
}
259259
};
@@ -269,7 +269,7 @@ tap.test('Supports ECMAScript modules with experimental-specifier-resolution', t
269269
touchFile('message.js');
270270
return out2 => {
271271
if (out2.match(/Restarting/)) {
272-
t.like(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
272+
t.match(out2, /\[INFO\] \d{2}:\d{2}:\d{2} Restarting/);
273273
return { exit: t.end.bind(t) };
274274
}
275275
};

0 commit comments

Comments
 (0)