MCPcopy
hub / github.com/webpack/webpack / run

Function run

test/TestCases.template.js:409–494  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407
408 const compiler = webpack(options);
409 const run = () => {
410 const deprecationTracker = deprecationTracking.start();
411 compiler.run((err, _stats) => {
412 const stats = /** @type {import("../").Stats} */ (_stats);
413 const deprecations = deprecationTracker();
414 if (err) return done(err);
415 const infrastructureLogErrors = [
416 ...filterInfraStructureErrors(infraStructureLog, {
417 run: 3,
418 options
419 }),
420 ...infraStructureErrors.map((message) => ({ message }))
421 ];
422 if (
423 infrastructureLogErrors.length &&
424 checkArrayExpectation(
425 testDirectory,
426 { infrastructureLogs: infrastructureLogErrors },
427 "infrastructureLog",
428 "infrastructure-log",
429 "InfrastructureLog",
430 options,
431 done
432 )
433 ) {
434 return;
435 }
436 compiler.close((err) => {
437 if (err) return done(err);
438 const statOptions = {
439 preset: "verbose",
440 colors: false,
441 modules: true,
442 reasonsSpace: 1000
443 };
444 fs.mkdirSync(outputDirectory, { recursive: true });
445 fs.writeFileSync(
446 path.join(outputDirectory, "stats.txt"),
447 stats.toString(statOptions),
448 "utf8"
449 );
450 const jsonStats = stats.toJson({
451 errorDetails: true,
452 modules: false,
453 assets: false,
454 chunks: false
455 });
456 if (
457 checkArrayExpectation(
458 testDirectory,
459 jsonStats,
460 "error",
461 "Error",
462 options,
463 done
464 )
465 ) {
466 return;

Callers 5

describeCasesFunction · 0.70
processQueueWorkerMethod · 0.50
runMethod · 0.50
_goMethod · 0.50
runMethod · 0.50

Calls 5

resolveMethod · 0.65
runMethod · 0.45
closeMethod · 0.45
toStringMethod · 0.45
toJsonMethod · 0.45

Tested by

no test coverage detected