Skip to content

Commit 3f21ce5

Browse files
committed
test: refactor into async-await
1 parent c6b90ee commit 3f21ce5

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

test/parallel/test-debugger-object-type-remote-object.js

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,33 @@ const assert = require('assert');
1010

1111
const cli = startCLI([fixtures.path('debugger/empty.js')]);
1212

13-
function onFatal(error) {
14-
cli.quit();
15-
throw error;
16-
}
17-
18-
cli.waitForInitialBreak()
19-
.then(() => cli.waitForPrompt())
20-
.then(() => cli.command('exec new Date(0)'))
21-
.then(() => assert.match(cli.output, /1970-01-01T00:00:00\.000Z/))
22-
.then(() => cli.command('exec null'))
23-
.then(() => assert.match(cli.output, /null/))
24-
.then(() => cli.command('exec /regex/g'))
25-
.then(() => assert.match(cli.output, /\/regex\/g/))
26-
.then(() => cli.command('exec new Map()'))
27-
.then(() => assert.match(cli.output, /Map\(0\) {}/))
28-
.then(() => cli.command('exec new Map([["a",1],["b",2]])'))
29-
.then(() => assert.match(cli.output, /Map\(2\) { a => 1, b => 2 }/))
30-
.then(() => cli.command('exec new Set()'))
31-
.then(() => assert.match(cli.output, /Set\(0\) {}/))
32-
.then(() => cli.command('exec new Set([1,2])'))
33-
.then(() => assert.match(cli.output, /Set\(2\) { 1, 2 }/))
34-
.then(() => cli.command('exec new Set([{a:1},new Set([1])])'))
35-
.then(() => assert.match(cli.output, /Set\(2\) { { a: 1 }, Set\(1\) { \.\.\. } }/))
36-
.then(() => cli.command('exec a={}; a'))
37-
.then(() => assert.match(cli.output, /{}/))
38-
.then(() => cli.command('exec a={a:1,b:{c:1}}; a'))
39-
.then(() => assert.match(cli.output, /{ a: 1, b: Object }/))
40-
.then(() => cli.command('exec a=[]; a'))
41-
.then(() => assert.match(cli.output, /\[\]/))
42-
.then(() => cli.command('exec a=[1,2]; a'))
43-
.then(() => assert.match(cli.output, /\[ 1, 2 \]/))
44-
.then(() => cli.quit())
45-
.then(null, onFatal);
13+
(async () => {
14+
await cli.waitForInitialBreak();
15+
await cli.waitForPrompt();
16+
await cli.command('exec new Date(0)');
17+
assert.match(cli.output, /1970-01-01T00:00:00\.000Z/);
18+
await cli.command('exec null');
19+
assert.match(cli.output, /null/);
20+
await cli.command('exec /regex/g');
21+
assert.match(cli.output, /\/regex\/g/);
22+
await cli.command('exec new Map()');
23+
assert.match(cli.output, /Map\(0\) {}/);
24+
await cli.command('exec new Map([["a",1],["b",2]])');
25+
assert.match(cli.output, /Map\(2\) { a => 1, b => 2 }/);
26+
await cli.command('exec new Set()');
27+
assert.match(cli.output, /Set\(0\) {}/);
28+
await cli.command('exec new Set([1,2])');
29+
assert.match(cli.output, /Set\(2\) { 1, 2 }/);
30+
await cli.command('exec new Set([{a:1},new Set([1])])');
31+
assert.match(cli.output, /Set\(2\) { { a: 1 }, Set\(1\) { \.\.\. } }/);
32+
await cli.command('exec a={}; a');
33+
assert.match(cli.output, /{}/);
34+
await cli.command('exec a={a:1,b:{c:1}}; a');
35+
assert.match(cli.output, /{ a: 1, b: Object }/);
36+
await cli.command('exec a=[]; a');
37+
assert.match(cli.output, /\[\]/);
38+
await cli.command('exec a=[1,2]; a');
39+
assert.match(cli.output, /\[ 1, 2 \]/);
40+
})()
41+
.finally(() => cli.quit())
42+
.then(common.mustCall());

0 commit comments

Comments
 (0)