@powerlines/plugin-jest 0.1.125 → 0.1.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,29 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/index.cjs CHANGED
@@ -1,7 +1,110 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`@stryke/path/join`),r=require(`chalk`);r=e.__toESM(r);let i=require(`jest`),a=require(`jest-util`);const o=(e={})=>({name:`jest`,async config(){let t={$0:void 0,_:[],coverage:e.codeCoverage,bail:e.bail,cache:!0,cacheDirectory:(0,n.joinPaths)(this.cachePath,`jest`),ci:e.ci,color:e.colors??!0,debug:this.config.mode===`development`,detectOpenHandles:e.detectOpenHandles,forceExit:e.forceExit,logHeapUsage:e.logHeapUsage,detectLeaks:e.detectLeaks,json:e.json,maxWorkers:e.maxWorkers,onlyChanged:e.onlyChanged,changedSince:e.changedSince,outputFile:e.outputFile,passWithNoTests:e.passWithNoTests,runInBand:e.runInBand,showConfig:e.showConfig,silent:e.silent,testLocationInResults:e.testLocationInResults,testNamePattern:e.testNamePattern,testPathPatterns:e.testPathPatterns,testPathIgnorePatterns:e.testPathIgnorePatterns,testTimeout:e.testTimeout,colors:e.colors??!0,verbose:e.verbose,testResultsProcessor:e.testResultsProcessor,updateSnapshot:e.updateSnapshot,useStderr:e.useStderr,watch:e.watch,watchAll:e.watchAll,randomize:e.randomize};if(e.testFile&&t._.push(e.testFile),e.findRelatedTests){let n=e.findRelatedTests.map(e=>e.trim());t._.push(...n),t.findRelatedTests=!0}return e.coverageDirectory&&(t.coverageDirectory=(0,n.joinPaths)(this.workspaceConfig.workspaceRoot,e.coverageDirectory)),e.clearCache&&(t.clearCache=!0),e.reporters&&e.reporters.length>0&&(t.reporters=e.reporters),Array.isArray(e.coverageReporters)&&e.coverageReporters.length>0&&(t.coverageReporters=e.coverageReporters),{test:{jest:t}}},async test(){if(this.config.test.jest){let{results:e}=await(0,i.runCLI)(this.config.test.jest,[(0,n.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot)]),o=e.snapshot,s=o.added,c=o.unmatched,l=o.unchecked,u=o.filesRemoved,d=o.didUpdate,f=o.matched,p=o.total,m=o.updated,h=e.numFailedTestSuites,g=e.numPassedTestSuites,_=e.numPendingTestSuites,v=h+g,y=e.testResults.length,b=e.numFailedTests,x=e.numPassedTests,S=e.numPendingTests,C=e.numTodoTests,w=e.numTotalTests,T=`${r.default.bold(`Test Suites: `)+(h?`${r.default.bold(r.default.red(`${h} failed`))}, `:``)+(_?`${r.default.bold(r.default.yellow(`${_} skipped`))}, `:``)+(g?`${r.default.bold(r.default.green(`${g} passed`))}, `:``)+(v===y?y:`${v} of ${y}`)} total`,E=`${r.default.bold(`Tests: `)+(b>0?`${r.default.bold(r.default.red(`${b} failed`))}, `:``)+(S>0?`${r.default.bold(r.default.yellow(`${S} skipped`))}, `:``)+(C>0?`${r.default.bold(r.default.magenta(`${C} todo`))}, `:``)+(x>0?`${r.default.bold(r.default.green(`${x} passed`))}, `:``)}${w} total`,D=`${r.default.bold(`Snapshots: `)+(c?`${r.default.bold(r.default.red(`${c} failed`))}, `:``)+(l&&!d?`${r.default.bold(r.default.yellow(`${l} obsolete`))}, `:``)+(l&&d?`${r.default.bold(r.default.green(`${l} removed`))}, `:``)+(u&&!d?`${r.default.bold(r.default.yellow(`${(0,a.pluralize)(`file`,u)} obsolete`))}, `:``)+(u&&d?`${r.default.bold(r.default.green(`${(0,a.pluralize)(`file`,u)} removed`))}, `:``)+(m?`${r.default.bold(r.default.green(`${m} updated`))}, `:``)+(s?`${r.default.bold(r.default.green(`${s} written`))}, `:``)+(f?`${r.default.bold(r.default.green(`${f} passed`))}, `:``)}${p} total`;this.log(t.LogLevelLabel.INFO,`
2
- ${r.default.bold(`Test result summary:`)}
3
- ${T}
4
- ${E}
5
- ${D}
6
- ${r.default.bold(`Time:`)} ${(0,a.formatTime)((Date.now()-e.startTime)/1e3)}
7
- `)}}});var s=o;exports.default=s,exports.plugin=o;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
+ let __stryke_path_join = require("@stryke/path/join");
5
+ let chalk = require("chalk");
6
+ chalk = require_rolldown_runtime.__toESM(chalk);
7
+ let jest = require("jest");
8
+ let jest_util = require("jest-util");
9
+
10
+ //#region src/index.ts
11
+ /**
12
+ * Jest plugin for Powerlines.
13
+ *
14
+ * @param options - The Jest plugin user configuration options.
15
+ * @returns A Powerlines plugin that integrates Jest testing.
16
+ */
17
+ const plugin = (options = {}) => {
18
+ return {
19
+ name: "jest",
20
+ async config() {
21
+ const config = {
22
+ $0: void 0,
23
+ _: [],
24
+ coverage: options.codeCoverage,
25
+ bail: options.bail,
26
+ cache: true,
27
+ cacheDirectory: (0, __stryke_path_join.joinPaths)(this.cachePath, "jest"),
28
+ ci: options.ci,
29
+ color: options.colors ?? true,
30
+ debug: this.config.mode === "development",
31
+ detectOpenHandles: options.detectOpenHandles,
32
+ forceExit: options.forceExit,
33
+ logHeapUsage: options.logHeapUsage,
34
+ detectLeaks: options.detectLeaks,
35
+ json: options.json,
36
+ maxWorkers: options.maxWorkers,
37
+ onlyChanged: options.onlyChanged,
38
+ changedSince: options.changedSince,
39
+ outputFile: options.outputFile,
40
+ passWithNoTests: options.passWithNoTests,
41
+ runInBand: options.runInBand,
42
+ showConfig: options.showConfig,
43
+ silent: options.silent,
44
+ testLocationInResults: options.testLocationInResults,
45
+ testNamePattern: options.testNamePattern,
46
+ testPathPatterns: options.testPathPatterns,
47
+ testPathIgnorePatterns: options.testPathIgnorePatterns,
48
+ testTimeout: options.testTimeout,
49
+ colors: options.colors ?? true,
50
+ verbose: options.verbose,
51
+ testResultsProcessor: options.testResultsProcessor,
52
+ updateSnapshot: options.updateSnapshot,
53
+ useStderr: options.useStderr,
54
+ watch: options.watch,
55
+ watchAll: options.watchAll,
56
+ randomize: options.randomize
57
+ };
58
+ if (options.testFile) config._.push(options.testFile);
59
+ if (options.findRelatedTests) {
60
+ const parsedTests = options.findRelatedTests.map((s) => s.trim());
61
+ config._.push(...parsedTests);
62
+ config.findRelatedTests = true;
63
+ }
64
+ if (options.coverageDirectory) config.coverageDirectory = (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, options.coverageDirectory);
65
+ if (options.clearCache) config.clearCache = true;
66
+ if (options.reporters && options.reporters.length > 0) config.reporters = options.reporters;
67
+ if (Array.isArray(options.coverageReporters) && options.coverageReporters.length > 0) config.coverageReporters = options.coverageReporters;
68
+ return { test: { jest: config } };
69
+ },
70
+ async test() {
71
+ if (this.config.test.jest) {
72
+ const { results } = await (0, jest.runCLI)(this.config.test.jest, [(0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot)]);
73
+ const snapshotResults = results.snapshot;
74
+ const snapshotsAdded = snapshotResults.added;
75
+ const snapshotsFailed = snapshotResults.unmatched;
76
+ const snapshotsOutdated = snapshotResults.unchecked;
77
+ const snapshotsFilesRemoved = snapshotResults.filesRemoved;
78
+ const snapshotsDidUpdate = snapshotResults.didUpdate;
79
+ const snapshotsPassed = snapshotResults.matched;
80
+ const snapshotsTotal = snapshotResults.total;
81
+ const snapshotsUpdated = snapshotResults.updated;
82
+ const suitesFailed = results.numFailedTestSuites;
83
+ const suitesPassed = results.numPassedTestSuites;
84
+ const suitesPending = results.numPendingTestSuites;
85
+ const suitesRun = suitesFailed + suitesPassed;
86
+ const suitesTotal = results.testResults.length;
87
+ const testsFailed = results.numFailedTests;
88
+ const testsPassed = results.numPassedTests;
89
+ const testsPending = results.numPendingTests;
90
+ const testsTodo = results.numTodoTests;
91
+ const testsTotal = results.numTotalTests;
92
+ const suites = `${chalk.default.bold("Test Suites: ") + (suitesFailed ? `${chalk.default.bold(chalk.default.red(`${suitesFailed} failed`))}, ` : "") + (suitesPending ? `${chalk.default.bold(chalk.default.yellow(`${suitesPending} skipped`))}, ` : "") + (suitesPassed ? `${chalk.default.bold(chalk.default.green(`${suitesPassed} passed`))}, ` : "") + (suitesRun !== suitesTotal ? `${suitesRun} of ${suitesTotal}` : suitesTotal)} total`;
93
+ const tests = `${chalk.default.bold("Tests: ") + (testsFailed > 0 ? `${chalk.default.bold(chalk.default.red(`${testsFailed} failed`))}, ` : "") + (testsPending > 0 ? `${chalk.default.bold(chalk.default.yellow(`${testsPending} skipped`))}, ` : "") + (testsTodo > 0 ? `${chalk.default.bold(chalk.default.magenta(`${testsTodo} todo`))}, ` : "") + (testsPassed > 0 ? `${chalk.default.bold(chalk.default.green(`${testsPassed} passed`))}, ` : "")}${testsTotal} total`;
94
+ const snapshots = `${chalk.default.bold("Snapshots: ") + (snapshotsFailed ? `${chalk.default.bold(chalk.default.red(`${snapshotsFailed} failed`))}, ` : "") + (snapshotsOutdated && !snapshotsDidUpdate ? `${chalk.default.bold(chalk.default.yellow(`${snapshotsOutdated} obsolete`))}, ` : "") + (snapshotsOutdated && snapshotsDidUpdate ? `${chalk.default.bold(chalk.default.green(`${snapshotsOutdated} removed`))}, ` : "") + (snapshotsFilesRemoved && !snapshotsDidUpdate ? `${chalk.default.bold(chalk.default.yellow(`${(0, jest_util.pluralize)("file", snapshotsFilesRemoved)} obsolete`))}, ` : "") + (snapshotsFilesRemoved && snapshotsDidUpdate ? `${chalk.default.bold(chalk.default.green(`${(0, jest_util.pluralize)("file", snapshotsFilesRemoved)} removed`))}, ` : "") + (snapshotsUpdated ? `${chalk.default.bold(chalk.default.green(`${snapshotsUpdated} updated`))}, ` : "") + (snapshotsAdded ? `${chalk.default.bold(chalk.default.green(`${snapshotsAdded} written`))}, ` : "") + (snapshotsPassed ? `${chalk.default.bold(chalk.default.green(`${snapshotsPassed} passed`))}, ` : "")}${snapshotsTotal} total`;
95
+ this.log(__storm_software_config_tools_types.LogLevelLabel.INFO, `
96
+ ${chalk.default.bold(`Test result summary:`)}
97
+ ${suites}
98
+ ${tests}
99
+ ${snapshots}
100
+ ${chalk.default.bold(`Time:`)} ${(0, jest_util.formatTime)((Date.now() - results.startTime) / 1e3)}
101
+ `);
102
+ }
103
+ }
104
+ };
105
+ };
106
+ var src_default = plugin;
107
+
108
+ //#endregion
109
+ exports.default = src_default;
110
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1,7 +1,106 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{joinPaths as t}from"@stryke/path/join";import n from"chalk";import{runCLI as r}from"jest";import{formatTime as i,pluralize as a}from"jest-util";const o=(o={})=>({name:`jest`,async config(){let e={$0:void 0,_:[],coverage:o.codeCoverage,bail:o.bail,cache:!0,cacheDirectory:t(this.cachePath,`jest`),ci:o.ci,color:o.colors??!0,debug:this.config.mode===`development`,detectOpenHandles:o.detectOpenHandles,forceExit:o.forceExit,logHeapUsage:o.logHeapUsage,detectLeaks:o.detectLeaks,json:o.json,maxWorkers:o.maxWorkers,onlyChanged:o.onlyChanged,changedSince:o.changedSince,outputFile:o.outputFile,passWithNoTests:o.passWithNoTests,runInBand:o.runInBand,showConfig:o.showConfig,silent:o.silent,testLocationInResults:o.testLocationInResults,testNamePattern:o.testNamePattern,testPathPatterns:o.testPathPatterns,testPathIgnorePatterns:o.testPathIgnorePatterns,testTimeout:o.testTimeout,colors:o.colors??!0,verbose:o.verbose,testResultsProcessor:o.testResultsProcessor,updateSnapshot:o.updateSnapshot,useStderr:o.useStderr,watch:o.watch,watchAll:o.watchAll,randomize:o.randomize};if(o.testFile&&e._.push(o.testFile),o.findRelatedTests){let t=o.findRelatedTests.map(e=>e.trim());e._.push(...t),e.findRelatedTests=!0}return o.coverageDirectory&&(e.coverageDirectory=t(this.workspaceConfig.workspaceRoot,o.coverageDirectory)),o.clearCache&&(e.clearCache=!0),o.reporters&&o.reporters.length>0&&(e.reporters=o.reporters),Array.isArray(o.coverageReporters)&&o.coverageReporters.length>0&&(e.coverageReporters=o.coverageReporters),{test:{jest:e}}},async test(){if(this.config.test.jest){let{results:o}=await r(this.config.test.jest,[t(this.workspaceConfig.workspaceRoot,this.config.projectRoot)]),s=o.snapshot,c=s.added,l=s.unmatched,u=s.unchecked,d=s.filesRemoved,f=s.didUpdate,p=s.matched,m=s.total,h=s.updated,g=o.numFailedTestSuites,_=o.numPassedTestSuites,v=o.numPendingTestSuites,y=g+_,b=o.testResults.length,x=o.numFailedTests,S=o.numPassedTests,C=o.numPendingTests,w=o.numTodoTests,T=o.numTotalTests,E=`${n.bold(`Test Suites: `)+(g?`${n.bold(n.red(`${g} failed`))}, `:``)+(v?`${n.bold(n.yellow(`${v} skipped`))}, `:``)+(_?`${n.bold(n.green(`${_} passed`))}, `:``)+(y===b?b:`${y} of ${b}`)} total`,D=`${n.bold(`Tests: `)+(x>0?`${n.bold(n.red(`${x} failed`))}, `:``)+(C>0?`${n.bold(n.yellow(`${C} skipped`))}, `:``)+(w>0?`${n.bold(n.magenta(`${w} todo`))}, `:``)+(S>0?`${n.bold(n.green(`${S} passed`))}, `:``)}${T} total`,O=`${n.bold(`Snapshots: `)+(l?`${n.bold(n.red(`${l} failed`))}, `:``)+(u&&!f?`${n.bold(n.yellow(`${u} obsolete`))}, `:``)+(u&&f?`${n.bold(n.green(`${u} removed`))}, `:``)+(d&&!f?`${n.bold(n.yellow(`${a(`file`,d)} obsolete`))}, `:``)+(d&&f?`${n.bold(n.green(`${a(`file`,d)} removed`))}, `:``)+(h?`${n.bold(n.green(`${h} updated`))}, `:``)+(c?`${n.bold(n.green(`${c} written`))}, `:``)+(p?`${n.bold(n.green(`${p} passed`))}, `:``)}${m} total`;this.log(e.INFO,`
2
- ${n.bold(`Test result summary:`)}
3
- ${E}
4
- ${D}
5
- ${O}
6
- ${n.bold(`Time:`)} ${i((Date.now()-o.startTime)/1e3)}
7
- `)}}});var s=o;export{s as default,o as plugin};
1
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
2
+ import { joinPaths } from "@stryke/path/join";
3
+ import chalk from "chalk";
4
+ import { runCLI } from "jest";
5
+ import { formatTime, pluralize } from "jest-util";
6
+
7
+ //#region src/index.ts
8
+ /**
9
+ * Jest plugin for Powerlines.
10
+ *
11
+ * @param options - The Jest plugin user configuration options.
12
+ * @returns A Powerlines plugin that integrates Jest testing.
13
+ */
14
+ const plugin = (options = {}) => {
15
+ return {
16
+ name: "jest",
17
+ async config() {
18
+ const config = {
19
+ $0: void 0,
20
+ _: [],
21
+ coverage: options.codeCoverage,
22
+ bail: options.bail,
23
+ cache: true,
24
+ cacheDirectory: joinPaths(this.cachePath, "jest"),
25
+ ci: options.ci,
26
+ color: options.colors ?? true,
27
+ debug: this.config.mode === "development",
28
+ detectOpenHandles: options.detectOpenHandles,
29
+ forceExit: options.forceExit,
30
+ logHeapUsage: options.logHeapUsage,
31
+ detectLeaks: options.detectLeaks,
32
+ json: options.json,
33
+ maxWorkers: options.maxWorkers,
34
+ onlyChanged: options.onlyChanged,
35
+ changedSince: options.changedSince,
36
+ outputFile: options.outputFile,
37
+ passWithNoTests: options.passWithNoTests,
38
+ runInBand: options.runInBand,
39
+ showConfig: options.showConfig,
40
+ silent: options.silent,
41
+ testLocationInResults: options.testLocationInResults,
42
+ testNamePattern: options.testNamePattern,
43
+ testPathPatterns: options.testPathPatterns,
44
+ testPathIgnorePatterns: options.testPathIgnorePatterns,
45
+ testTimeout: options.testTimeout,
46
+ colors: options.colors ?? true,
47
+ verbose: options.verbose,
48
+ testResultsProcessor: options.testResultsProcessor,
49
+ updateSnapshot: options.updateSnapshot,
50
+ useStderr: options.useStderr,
51
+ watch: options.watch,
52
+ watchAll: options.watchAll,
53
+ randomize: options.randomize
54
+ };
55
+ if (options.testFile) config._.push(options.testFile);
56
+ if (options.findRelatedTests) {
57
+ const parsedTests = options.findRelatedTests.map((s) => s.trim());
58
+ config._.push(...parsedTests);
59
+ config.findRelatedTests = true;
60
+ }
61
+ if (options.coverageDirectory) config.coverageDirectory = joinPaths(this.workspaceConfig.workspaceRoot, options.coverageDirectory);
62
+ if (options.clearCache) config.clearCache = true;
63
+ if (options.reporters && options.reporters.length > 0) config.reporters = options.reporters;
64
+ if (Array.isArray(options.coverageReporters) && options.coverageReporters.length > 0) config.coverageReporters = options.coverageReporters;
65
+ return { test: { jest: config } };
66
+ },
67
+ async test() {
68
+ if (this.config.test.jest) {
69
+ const { results } = await runCLI(this.config.test.jest, [joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot)]);
70
+ const snapshotResults = results.snapshot;
71
+ const snapshotsAdded = snapshotResults.added;
72
+ const snapshotsFailed = snapshotResults.unmatched;
73
+ const snapshotsOutdated = snapshotResults.unchecked;
74
+ const snapshotsFilesRemoved = snapshotResults.filesRemoved;
75
+ const snapshotsDidUpdate = snapshotResults.didUpdate;
76
+ const snapshotsPassed = snapshotResults.matched;
77
+ const snapshotsTotal = snapshotResults.total;
78
+ const snapshotsUpdated = snapshotResults.updated;
79
+ const suitesFailed = results.numFailedTestSuites;
80
+ const suitesPassed = results.numPassedTestSuites;
81
+ const suitesPending = results.numPendingTestSuites;
82
+ const suitesRun = suitesFailed + suitesPassed;
83
+ const suitesTotal = results.testResults.length;
84
+ const testsFailed = results.numFailedTests;
85
+ const testsPassed = results.numPassedTests;
86
+ const testsPending = results.numPendingTests;
87
+ const testsTodo = results.numTodoTests;
88
+ const testsTotal = results.numTotalTests;
89
+ const suites = `${chalk.bold("Test Suites: ") + (suitesFailed ? `${chalk.bold(chalk.red(`${suitesFailed} failed`))}, ` : "") + (suitesPending ? `${chalk.bold(chalk.yellow(`${suitesPending} skipped`))}, ` : "") + (suitesPassed ? `${chalk.bold(chalk.green(`${suitesPassed} passed`))}, ` : "") + (suitesRun !== suitesTotal ? `${suitesRun} of ${suitesTotal}` : suitesTotal)} total`;
90
+ const tests = `${chalk.bold("Tests: ") + (testsFailed > 0 ? `${chalk.bold(chalk.red(`${testsFailed} failed`))}, ` : "") + (testsPending > 0 ? `${chalk.bold(chalk.yellow(`${testsPending} skipped`))}, ` : "") + (testsTodo > 0 ? `${chalk.bold(chalk.magenta(`${testsTodo} todo`))}, ` : "") + (testsPassed > 0 ? `${chalk.bold(chalk.green(`${testsPassed} passed`))}, ` : "")}${testsTotal} total`;
91
+ const snapshots = `${chalk.bold("Snapshots: ") + (snapshotsFailed ? `${chalk.bold(chalk.red(`${snapshotsFailed} failed`))}, ` : "") + (snapshotsOutdated && !snapshotsDidUpdate ? `${chalk.bold(chalk.yellow(`${snapshotsOutdated} obsolete`))}, ` : "") + (snapshotsOutdated && snapshotsDidUpdate ? `${chalk.bold(chalk.green(`${snapshotsOutdated} removed`))}, ` : "") + (snapshotsFilesRemoved && !snapshotsDidUpdate ? `${chalk.bold(chalk.yellow(`${pluralize("file", snapshotsFilesRemoved)} obsolete`))}, ` : "") + (snapshotsFilesRemoved && snapshotsDidUpdate ? `${chalk.bold(chalk.green(`${pluralize("file", snapshotsFilesRemoved)} removed`))}, ` : "") + (snapshotsUpdated ? `${chalk.bold(chalk.green(`${snapshotsUpdated} updated`))}, ` : "") + (snapshotsAdded ? `${chalk.bold(chalk.green(`${snapshotsAdded} written`))}, ` : "") + (snapshotsPassed ? `${chalk.bold(chalk.green(`${snapshotsPassed} passed`))}, ` : "")}${snapshotsTotal} total`;
92
+ this.log(LogLevelLabel.INFO, `
93
+ ${chalk.bold(`Test result summary:`)}
94
+ ${suites}
95
+ ${tests}
96
+ ${snapshots}
97
+ ${chalk.bold(`Time:`)} ${formatTime((Date.now() - results.startTime) / 1e3)}
98
+ `);
99
+ }
100
+ }
101
+ };
102
+ };
103
+ var src_default = plugin;
104
+
105
+ //#endregion
106
+ export { src_default as default, plugin };
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
304
328
  /**
305
329
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
306
330
  *
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
333
  * @param path - An optional path to write the builtin file to
310
334
  * @param options - Additional options for writing the builtin file
311
335
  */
312
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
313
337
  /**
314
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
315
339
  *
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
80
80
  */
81
81
  allowReturnOutsideFunction?: boolean;
82
82
  }
83
+ interface EmitOptions extends WriteOptions {
84
+ /**
85
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
86
+ */
87
+ emitWithBundler?: boolean;
88
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
89
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
90
+ }
83
91
  /**
84
92
  * Options for emitting entry virtual files
85
93
  */
86
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
94
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
87
95
  /**
88
96
  * The unresolved Powerlines context.
89
97
  *
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
294
302
  * The Powerlines builtin virtual files
295
303
  */
296
304
  getBuiltins: () => Promise<VirtualFile[]>;
305
+ /**
306
+ * Resolves a file and writes it to the VFS if it does not already exist
307
+ *
308
+ * @param code - The source code of the file
309
+ * @param path - The path to write the file to
310
+ * @param options - Additional options for writing the file
311
+ */
312
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
313
+ /**
314
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
315
+ *
316
+ * @param code - The source code of the file
317
+ * @param path - The path to write the file to
318
+ * @param options - Additional options for writing the file
319
+ */
320
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
297
321
  /**
298
322
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
299
323
  *
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
302
326
  * @param path - An optional path to write the builtin file to
303
327
  * @param options - Additional options for writing the builtin file
304
328
  */
305
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
329
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
306
330
  /**
307
331
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
308
332
  *
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
335
  * @param path - An optional path to write the builtin file to
312
336
  * @param options - Additional options for writing the builtin file
313
337
  */
314
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
338
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
315
339
  /**
316
340
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
317
341
  *
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-jest",
3
- "version": "0.1.125",
3
+ "version": "0.1.126",
4
4
  "type": "module",
5
5
  "description": "A package containing the Jest testing plugin for Powerlines.",
6
6
  "repository": {
@@ -119,21 +119,21 @@
119
119
  "dependencies": {
120
120
  "@jest/reporters": "^30.2.0",
121
121
  "@jest/test-result": "^30.2.0",
122
- "@stryke/fs": "^0.33.26",
123
- "@stryke/path": "^0.24.0",
122
+ "@stryke/fs": "^0.33.27",
123
+ "@stryke/path": "^0.24.1",
124
124
  "chalk": "5.6.2",
125
125
  "defu": "^6.1.4",
126
126
  "jest": "^30.2.0",
127
127
  "jest-config": "^30.2.0",
128
128
  "jest-resolve": "^30.2.0",
129
129
  "jest-util": "^30.2.0",
130
- "powerlines": "^0.36.22"
130
+ "powerlines": "^0.36.23"
131
131
  },
132
132
  "devDependencies": {
133
133
  "@jest/types": "^30.2.0",
134
- "@powerlines/nx": "^0.11.48",
134
+ "@powerlines/nx": "^0.11.49",
135
135
  "@types/jest": "^30.0.0"
136
136
  },
137
137
  "publishConfig": { "access": "public" },
138
- "gitHead": "f88fe8eb30f96536b83fc9af884972d48e31e63a"
138
+ "gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
139
139
  }