Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 7b31acf

Browse files
authored
Merge pull request #36 from nodejs/jk-embedded-failures
Update test suite to pass on latest nightly
2 parents 4e7add6 + 6ce8c16 commit 7b31acf

15 files changed

+60
-45
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"scripts": {
1717
"pretest": "eslint --rulesdir=tools/eslint-rules lib test",
18-
"test": "tap \"test/**/*.test.js\"",
18+
"test": "tap test",
1919
"posttest": "nlm verify"
2020
},
2121
"nlm": {

test/cli/backtrace.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test('display and navigate backtrace', (t) => {
1414
throw error;
1515
}
1616

17-
return cli.waitFor(/break/)
17+
return cli.waitForInitialBreak()
1818
.then(() => cli.waitForPrompt())
1919
.then(() => cli.stepCommand('c'))
2020
.then(() => cli.command('bt'))

test/cli/break.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test('stepping through breakpoints', (t) => {
1414
throw error;
1515
}
1616

17-
return cli.waitFor(/break/)
17+
return cli.waitForInitialBreak()
1818
.then(() => cli.waitForPrompt())
1919
.then(() => {
2020
t.match(
@@ -132,7 +132,7 @@ test('sb before loading file', (t) => {
132132
throw error;
133133
}
134134

135-
return cli.waitFor(/break/)
135+
return cli.waitForInitialBreak()
136136
.then(() => cli.waitForPrompt())
137137
.then(() => cli.command('sb("other.js", 3)'))
138138
.then(() => {
@@ -161,7 +161,7 @@ test('clearBreakpoint', (t) => {
161161
throw error;
162162
}
163163

164-
return cli.waitFor(/break/)
164+
return cli.waitForInitialBreak()
165165
.then(() => cli.waitForPrompt())
166166
.then(() => cli.command('sb("break.js", 3)'))
167167
.then(() => cli.command('sb("break.js", 9)'))

test/cli/exceptions.test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ test('break on (uncaught) exceptions', (t) => {
1414
throw error;
1515
}
1616

17-
return cli.waitFor(/break/)
17+
return cli.waitForInitialBreak()
1818
.then(() => cli.waitForPrompt())
1919
.then(() => {
2020
t.match(cli.output, `break in ${script}:1`);
2121
})
2222
// making sure it will die by default:
2323
.then(() => cli.command('c'))
24-
.then(() => cli.waitFor(/disconnect/))
24+
// TODO: Remove FATAL ERROR once node doesn't show a FATAL ERROR anymore
25+
.then(() => cli.waitFor(/disconnect|FATAL ERROR/))
2526

2627
// Next run: With `breakOnException` it pauses in both places
2728
.then(() => cli.stepCommand('r'))
29+
.then(() => cli.waitForInitialBreak())
2830
.then(() => {
2931
t.match(cli.output, `break in ${script}:1`);
3032
})
@@ -41,6 +43,7 @@ test('break on (uncaught) exceptions', (t) => {
4143
// Next run: With `breakOnUncaught` it only pauses on the 2nd exception
4244
.then(() => cli.command('breakOnUncaught'))
4345
.then(() => cli.stepCommand('r')) // also, the setting survives the restart
46+
.then(() => cli.waitForInitialBreak())
4447
.then(() => {
4548
t.match(cli.output, `break in ${script}:1`);
4649
})
@@ -52,11 +55,13 @@ test('break on (uncaught) exceptions', (t) => {
5255
// Next run: Back to the initial state! It should die again.
5356
.then(() => cli.command('breakOnNone'))
5457
.then(() => cli.stepCommand('r'))
58+
.then(() => cli.waitForInitialBreak())
5559
.then(() => {
5660
t.match(cli.output, `break in ${script}:1`);
5761
})
5862
.then(() => cli.command('c'))
59-
.then(() => cli.waitFor(/disconnect/))
63+
// TODO: Remove FATAL ERROR once node doesn't show a FATAL ERROR anymore
64+
.then(() => cli.waitFor(/disconnect|FATAL ERROR/))
6065

6166
.then(() => cli.quit())
6267
.then(null, onFatal);

test/cli/exec.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('examples/alive.js', (t) => {
1111
throw error;
1212
}
1313

14-
return cli.waitFor(/break/)
14+
return cli.waitForInitialBreak()
1515
.then(() => cli.waitForPrompt())
1616
.then(() => cli.command('exec [typeof heartbeat, typeof process.exit]'))
1717
.then(() => {
@@ -60,7 +60,7 @@ test('exec .scope', (t) => {
6060
throw error;
6161
}
6262

63-
return cli.waitFor(/break/)
63+
return cli.waitForInitialBreak()
6464
.then(() => cli.waitForPrompt())
6565
.then(() => cli.stepCommand('c'))
6666
.then(() => cli.command('exec .scope'))

test/cli/help.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('examples/empty.js', (t) => {
1111
throw error;
1212
}
1313

14-
return cli.waitFor(/break/)
14+
return cli.waitForInitialBreak()
1515
.then(() => cli.waitForPrompt())
1616
.then(() => cli.command('help'))
1717
.then(() => {

test/cli/launch.test.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ const { test } = require('tap');
55

66
const startCLI = require('./start-cli');
77

8-
test('examples/empty.js', (t) => {
9-
const script = Path.join('examples', 'empty.js');
8+
test('examples/three-lines.js', (t) => {
9+
const script = Path.join('examples', 'three-lines.js');
1010
const cli = startCLI([script]);
1111

12-
return cli.waitFor(/break/)
12+
return cli.waitForInitialBreak()
1313
.then(() => cli.waitForPrompt())
1414
.then(() => {
1515
t.match(cli.output, 'debug>', 'prints a prompt');
16-
t.match(
17-
cli.output,
18-
'< Debugger listening on port 9229',
19-
'forwards child output');
2016
})
2117
.then(() => cli.command('["hello", "world"].join(" ")'))
2218
.then(() => {
@@ -45,7 +41,7 @@ test('run after quit / restart', (t) => {
4541
throw error;
4642
}
4743

48-
return cli.waitFor(/break/)
44+
return cli.waitForInitialBreak()
4945
.then(() => cli.waitForPrompt())
5046
.then(() => cli.stepCommand('n'))
5147
.then(() => {
@@ -72,6 +68,7 @@ test('run after quit / restart', (t) => {
7268
t.match(cli.output, 'Use `run` to start the app again');
7369
})
7470
.then(() => cli.stepCommand('run'))
71+
.then(() => cli.waitForInitialBreak())
7572
.then(() => cli.waitForPrompt())
7673
.then(() => {
7774
t.match(
@@ -87,6 +84,7 @@ test('run after quit / restart', (t) => {
8784
'steps to the 2nd line');
8885
})
8986
.then(() => cli.stepCommand('restart'))
87+
.then(() => cli.waitForInitialBreak())
9088
.then(() => {
9189
t.match(
9290
cli.output,
@@ -100,6 +98,7 @@ test('run after quit / restart', (t) => {
10098
t.match(cli.output, 'Use `run` to start the app again');
10199
})
102100
.then(() => cli.stepCommand('run'))
101+
.then(() => cli.waitForInitialBreak())
103102
.then(() => cli.waitForPrompt())
104103
.then(() => {
105104
t.match(

test/cli/low-level.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ const { test } = require('tap');
44
const startCLI = require('./start-cli');
55

66
test('Debugger agent direct access', (t) => {
7-
const cli = startCLI(['examples/empty.js']);
8-
const scriptPattern = /^\* (\d+): examples(?:\/|\\)empty.js/;
7+
const cli = startCLI(['examples/three-lines.js']);
8+
const scriptPattern = /^\* (\d+): examples(?:\/|\\)three-lines.js/;
99

1010
function onFatal(error) {
1111
cli.quit();
1212
throw error;
1313
}
1414

15-
return cli.waitFor(/break/)
15+
return cli.waitForInitialBreak()
1616
.then(() => cli.waitForPrompt())
1717
.then(() => cli.command('scripts'))
1818
.then(() => {
@@ -24,7 +24,10 @@ test('Debugger agent direct access', (t) => {
2424
.then(() => {
2525
t.match(
2626
cli.output,
27-
/scriptSource: '\(function \([^)]+\) \{ \\n}\);'/);
27+
/scriptSource: '\(function \(/);
28+
t.match(
29+
cli.output,
30+
/let x = 1;/);
2831
})
2932
.then(() => cli.quit())
3033
.then(null, onFatal);

test/cli/preserve-breaks.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test('run after quit / restart', (t) => {
1414
throw error;
1515
}
1616

17-
return cli.waitFor(/break/)
17+
return cli.waitForInitialBreak()
1818
.then(() => cli.waitForPrompt())
1919
.then(() => cli.command('breakpoints'))
2020
.then(() => {
@@ -33,8 +33,7 @@ test('run after quit / restart', (t) => {
3333
t.match(cli.output, `break in ${script}:3`);
3434
})
3535
.then(() => cli.command('restart'))
36-
.then(() => cli.waitFor([/break in examples/, /breakpoints restored/]))
37-
.then(() => cli.waitForPrompt())
36+
.then(() => cli.waitForInitialBreak())
3837
.then(() => {
3938
t.match(cli.output, `break in ${script}:1`);
4039
})

test/cli/profile.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test('profiles', (t) => {
1515
throw error;
1616
}
1717

18-
return cli.waitFor(/break/)
18+
return cli.waitForInitialBreak()
1919
.then(() => cli.waitForPrompt())
2020
.then(() => cli.command('exec console.profile()'))
2121
.then(() => {

0 commit comments

Comments
 (0)