MCPcopy Index your code
hub / github.com/nodejs/node / runTest

Function runTest

test/parallel/test-repl-reverse-search.js:286–362  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284}
285
286function runTest() {
287 const opts = tests.shift();
288 if (!opts) return; // All done
289
290 const { expected, skip } = opts;
291
292 // Test unsupported on platform.
293 if (skip) {
294 setImmediate(runTestWrap, true);
295 return;
296 }
297
298 const lastChunks = [];
299 let i = 0;
300
301 REPL.createInternalRepl(opts.env, {
302 input: new ActionStream(),
303 output: new stream.Writable({
304 write: common.mustCallAtLeast((chunk, _, next) => {
305 const output = chunk.toString();
306
307 if (!opts.showEscapeCodes &&
308 (output[0] === '\x1B' || /^[\r\n]+$/.test(output))) {
309 return next();
310 }
311
312 lastChunks.push(output);
313
314 if (expected.length && !opts.checkTotal) {
315 try {
316 assert.strictEqual(output, expected[i]);
317 } catch (e) {
318 console.error(`Failed test # ${numtests - tests.length}`);
319 console.error('Last outputs: ' + inspect(lastChunks, {
320 breakLength: 5, colors: true
321 }));
322 throw e;
323 }
324 i++;
325 }
326
327 next();
328 }),
329 }),
330 completer: opts.completer,
331 prompt,
332 useColors: opts.useColors || false,
333 terminal: true
334 }, common.mustCall((err, repl) => {
335 if (err) {
336 console.error(`Failed test # ${numtests - tests.length}`);
337 throw err;
338 }
339
340 repl.once('close', common.mustCall(() => {
341 if (opts.clean)
342 cleanupTmpFile();
343

Callers 1

Calls 12

nextFunction · 0.70
inspectFunction · 0.70
cleanupTmpFileFunction · 0.70
setImmediateFunction · 0.50
shiftMethod · 0.45
toStringMethod · 0.45
testMethod · 0.45
pushMethod · 0.45
errorMethod · 0.45
onceMethod · 0.45
definePropertyMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…