Skip to content

Commit 57008ac

Browse files
author
antelle
committed
tests fix
1 parent 98fd840 commit 57008ac

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

patch.test.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ describe('patch', () => {
132132
runTestApp('not-found.js');
133133
await assertExitsWithStatusCode(1);
134134
assertStdOutIsEmpty();
135-
const stderrStr = stdioToStr(stderrData);
136-
expect(stderrStr).toMatch(/Cannot find module .*not-found.js/);
135+
expect(stdioToStr(stderrData)).toMatch(/Cannot find module .*not-found.js/);
137136
});
138137
});
139138

@@ -336,13 +335,11 @@ function assertCrashed() {
336335
}
337336

338337
function assertContainsOnlyAppOutputInStdOut() {
339-
const stdoutStr = stdioToStr(stdoutData);
340-
expect(stdoutStr).toBe('Test app started');
338+
expect(stdioToStr(stdoutData)).toBe('Test app started');
341339
}
342340

343341
function assertContainsDebuggerMessageInStdErr(port) {
344-
const stderrStr = stdioToStr(stderrData);
345-
expect(stderrStr).toMatch(
342+
expect(stdioToStr(stderrData)).toMatch(
346343
new RegExp(
347344
`^Debugger listening on ws://127\\.0\\.0\\.1:${port}/[\\w-]{36}\\r?\\n` +
348345
'For help, see: https://nodejs.org/en/docs/inspector$'
@@ -351,8 +348,7 @@ function assertContainsDebuggerMessageInStdErr(port) {
351348
}
352349

353350
function assertContainsRemoteDebuggerMessageInStdErr(port) {
354-
const stderrStr = stdioToStr(stderrData);
355-
expect(stderrStr.trim()).toMatch(
351+
expect(stdioToStr(stderrData)).toMatch(
356352
new RegExp(
357353
`^DevTools listening on ws://127\\.0\\.0\\.1:${port}/devtools/browser/[\\w-]{36}$`
358354
)
@@ -368,7 +364,7 @@ function assertStdOutIsEmpty() {
368364
}
369365

370366
function stdioToStr(stdio) {
371-
return Buffer.from(stdio).toString('utf8').trim().replace(/\0/g, '');
367+
return Buffer.concat(stdio).toString('utf8').trim().replace(/\0/g, '');
372368
}
373369

374370
async function assertCanConnectTcpDebugger(port) {

0 commit comments

Comments
 (0)