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

Commit 2c224c5

Browse files
author
Jan Krems
committed
test: Accept any kind of "break"
1 parent 41148d7 commit 2c224c5

13 files changed

+33
-29
lines changed

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: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ 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(
2121
cli.output,
22-
`break in ${script}:1`,
22+
` in ${script}:1`,
2323
'pauses in the first line of the script');
2424
t.match(
2525
cli.output,
@@ -30,7 +30,7 @@ test('stepping through breakpoints', (t) => {
3030
.then(() => {
3131
t.match(
3232
cli.output,
33-
`break in ${script}:2`,
33+
` in ${script}:2`,
3434
'pauses in next line of the script');
3535
t.match(
3636
cli.output,
@@ -41,7 +41,7 @@ test('stepping through breakpoints', (t) => {
4141
.then(() => {
4242
t.match(
4343
cli.output,
44-
`break in ${script}:3`,
44+
` in ${script}:3`,
4545
'pauses in next line of the script');
4646
t.match(
4747
cli.output,
@@ -52,7 +52,7 @@ test('stepping through breakpoints', (t) => {
5252
.then(() => {
5353
t.match(
5454
cli.output,
55-
`break in ${script}:10`,
55+
` in ${script}:10`,
5656
'pauses on the next breakpoint');
5757
t.match(
5858
cli.output,
@@ -94,21 +94,21 @@ test('stepping through breakpoints', (t) => {
9494
.then(() => {
9595
t.match(
9696
cli.output,
97-
'break in timers.js',
97+
' in timers.js',
9898
'entered timers.js');
9999
})
100100
.then(() => cli.stepCommand('cont'))
101101
.then(() => {
102102
t.match(
103103
cli.output,
104-
`break in ${script}:16`,
104+
` in ${script}:16`,
105105
'found breakpoint we set above w/ line number only');
106106
})
107107
.then(() => cli.stepCommand('cont'))
108108
.then(() => {
109109
t.match(
110110
cli.output,
111-
`break in ${script}:6`,
111+
` in ${script}:6`,
112112
'found breakpoint we set above w/ line number & script');
113113
})
114114
.then(() => cli.stepCommand(''))
@@ -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(() => {
@@ -145,7 +145,7 @@ test('sb before loading file', (t) => {
145145
.then(() => {
146146
t.match(
147147
cli.output,
148-
`break in ${otherScript}:3`,
148+
` in ${otherScript}:3`,
149149
'found breakpoint in file that was not loaded yet');
150150
})
151151
.then(() => cli.quit())
@@ -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)'))
@@ -187,7 +187,7 @@ test('clearBreakpoint', (t) => {
187187
.then(() => {
188188
t.match(
189189
cli.output,
190-
`break in ${script}:9`,
190+
` in ${script}:9`,
191191
'hits the 2nd breakpoint because the 1st was cleared');
192192
})
193193
.then(() => cli.quit())

test/cli/exceptions.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ 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(() => {
20-
t.match(cli.output, `break in ${script}:1`);
20+
t.match(cli.output, ` in ${script}:1`);
2121
})
2222
// making sure it will die by default:
2323
.then(() => cli.command('c'))
@@ -26,7 +26,7 @@ test('break on (uncaught) exceptions', (t) => {
2626
// Next run: With `breakOnException` it pauses in both places
2727
.then(() => cli.stepCommand('r'))
2828
.then(() => {
29-
t.match(cli.output, `break in ${script}:1`);
29+
t.match(cli.output, ` in ${script}:1`);
3030
})
3131
.then(() => cli.command('breakOnException'))
3232
.then(() => cli.stepCommand('c'))
@@ -42,7 +42,7 @@ test('break on (uncaught) exceptions', (t) => {
4242
.then(() => cli.command('breakOnUncaught'))
4343
.then(() => cli.stepCommand('r')) // also, the setting survives the restart
4444
.then(() => {
45-
t.match(cli.output, `break in ${script}:1`);
45+
t.match(cli.output, ` in ${script}:1`);
4646
})
4747
.then(() => cli.stepCommand('c'))
4848
.then(() => {
@@ -53,7 +53,7 @@ test('break on (uncaught) exceptions', (t) => {
5353
.then(() => cli.command('breakOnNone'))
5454
.then(() => cli.stepCommand('r'))
5555
.then(() => {
56-
t.match(cli.output, `break in ${script}:1`);
56+
t.match(cli.output, ` in ${script}:1`);
5757
})
5858
.then(() => cli.command('c'))
5959
.then(() => cli.waitFor(/disconnect/))

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test('examples/empty.js', (t) => {
99
const script = Path.join('examples', 'empty.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');
@@ -45,7 +45,7 @@ test('run after quit / restart', (t) => {
4545
throw error;
4646
}
4747

48-
return cli.waitFor(/break/)
48+
return cli.waitForInitialBreak()
4949
.then(() => cli.waitForPrompt())
5050
.then(() => cli.stepCommand('n'))
5151
.then(() => {

test/cli/low-level.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('Debugger agent direct access', (t) => {
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(() => {

test/cli/preserve-breaks.test.js

Lines changed: 1 addition & 1 deletion
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(() => {

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(() => {

test/cli/scripts.test.js

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

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

test/cli/start-cli.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ function startCLI(args) {
9393
return this.waitFor(/>\s+$/, timeout);
9494
},
9595

96+
waitForInitialBreak(timeout = 2000) {
97+
return this.waitFor(/break/i, timeout);
98+
},
99+
96100
ctrlC() {
97101
return this.command('.interrupt');
98102
},

test/cli/use-strict.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test('for whiles that starts with strict directive', (t) => {
1414
throw error;
1515
}
1616

17-
return cli.waitFor(/break/)
17+
return cli.waitForInitialBreak()
1818
.then(() => cli.waitForPrompt())
1919
.then(() => {
2020
t.match(

test/cli/watchers.test.js

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

14-
return cli.waitFor(/break/)
14+
return cli.waitForInitialBreak()
1515
.then(() => cli.waitForPrompt())
1616
.then(() => cli.command('watch("x")'))
1717
.then(() => cli.command('watch("\\"Hello\\"")'))

0 commit comments

Comments
 (0)