MCPcopy
hub / github.com/CesiumGS/cesium / runCoverage

Function runCoverage

gulpfile.js:571–761  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

569 * @param {string} options.workspace The name of the workspace, if any.
570 */
571export async function runCoverage(options) {
572 const webglStub = options.webglStub ?? false;
573 const suppressPassed = options.suppressPassed ?? false;
574 const failTaskOnError = options.failTaskOnError ?? false;
575 const workspace = options.workspace;
576
577 const folders = [];
578 let browsers = ["Chrome"];
579 if (argv.browsers) {
580 browsers = argv.browsers.split(",");
581 }
582
583 const instrumenter = createInstrumenter({
584 esModules: true,
585 });
586
587 // Setup plugin to use instrumenter on source files.
588
589 const instrumentPlugin = {
590 name: "instrument",
591 setup: (build) => {
592 build.onLoad(
593 {
594 filter: options.filter,
595 },
596 async (args) => {
597 const source = await readFile(args.path, { encoding: "utf8" });
598 try {
599 const generatedCode = instrumenter.instrumentSync(
600 source,
601 args.path,
602 );
603
604 return { contents: generatedCode };
605 } catch (e) {
606 return {
607 errors: {
608 text: e.message,
609 },
610 };
611 }
612 },
613 );
614 },
615 };
616
617 const karmaBundle = join(options.outputDirectory, "karma-main.js");
618 await esbuild({
619 entryPoints: ["Specs/karma-main.js"],
620 bundle: true,
621 sourcemap: true,
622 format: "esm",
623 target: "es2020",
624 outfile: karmaBundle,
625 logLevel: "error", // print errors immediately, and collect warnings so we can filter out known ones
626 });
627
628 // Generate instrumented bundle for Specs.

Callers 1

coverageFunction · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…