@powerlines/plugin-jest 0.1.465 → 0.1.466
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.
- package/dist/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/index.cjs +108 -7
- package/dist/index.mjs +104 -7
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +4 -4
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
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,108 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
4
|
+
let chalk = require("chalk");
|
|
5
|
+
chalk = require_runtime.__toESM(chalk, 1);
|
|
6
|
+
let jest = require("jest");
|
|
7
|
+
let jest_util = require("jest-util");
|
|
8
|
+
|
|
9
|
+
//#region src/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* Jest plugin for Powerlines.
|
|
12
|
+
*
|
|
13
|
+
* @param options - The Jest plugin user configuration options.
|
|
14
|
+
* @returns A Powerlines plugin that integrates Jest testing.
|
|
15
|
+
*/
|
|
16
|
+
const plugin = (options = {}) => {
|
|
17
|
+
return {
|
|
18
|
+
name: "jest",
|
|
19
|
+
async config() {
|
|
20
|
+
const config = {
|
|
21
|
+
$0: void 0,
|
|
22
|
+
_: [],
|
|
23
|
+
coverage: options.codeCoverage,
|
|
24
|
+
bail: options.bail,
|
|
25
|
+
cache: true,
|
|
26
|
+
cacheDirectory: (0, _stryke_path_join.joinPaths)(this.cachePath, "jest"),
|
|
27
|
+
ci: options.ci,
|
|
28
|
+
color: options.colors ?? true,
|
|
29
|
+
debug: this.config.mode === "development",
|
|
30
|
+
detectOpenHandles: options.detectOpenHandles,
|
|
31
|
+
forceExit: options.forceExit,
|
|
32
|
+
logHeapUsage: options.logHeapUsage,
|
|
33
|
+
detectLeaks: options.detectLeaks,
|
|
34
|
+
json: options.json,
|
|
35
|
+
maxWorkers: options.maxWorkers,
|
|
36
|
+
onlyChanged: options.onlyChanged,
|
|
37
|
+
changedSince: options.changedSince,
|
|
38
|
+
outputFile: options.outputFile,
|
|
39
|
+
passWithNoTests: options.passWithNoTests,
|
|
40
|
+
runInBand: options.runInBand,
|
|
41
|
+
showConfig: options.showConfig,
|
|
42
|
+
silent: options.silent,
|
|
43
|
+
testLocationInResults: options.testLocationInResults,
|
|
44
|
+
testNamePattern: options.testNamePattern,
|
|
45
|
+
testPathPatterns: options.testPathPatterns,
|
|
46
|
+
testPathIgnorePatterns: options.testPathIgnorePatterns,
|
|
47
|
+
testTimeout: options.testTimeout,
|
|
48
|
+
colors: options.colors ?? true,
|
|
49
|
+
verbose: options.verbose,
|
|
50
|
+
testResultsProcessor: options.testResultsProcessor,
|
|
51
|
+
updateSnapshot: options.updateSnapshot,
|
|
52
|
+
useStderr: options.useStderr,
|
|
53
|
+
watch: options.watch,
|
|
54
|
+
watchAll: options.watchAll,
|
|
55
|
+
randomize: options.randomize
|
|
56
|
+
};
|
|
57
|
+
if (options.testFile) config._.push(options.testFile);
|
|
58
|
+
if (options.findRelatedTests) {
|
|
59
|
+
const parsedTests = options.findRelatedTests.map((s) => s.trim());
|
|
60
|
+
config._.push(...parsedTests);
|
|
61
|
+
config.findRelatedTests = true;
|
|
62
|
+
}
|
|
63
|
+
if (options.coverageDirectory) config.coverageDirectory = (0, _stryke_path_join.joinPaths)(this.config.cwd, options.coverageDirectory);
|
|
64
|
+
if (options.clearCache) config.clearCache = true;
|
|
65
|
+
if (options.reporters && options.reporters.length > 0) config.reporters = options.reporters;
|
|
66
|
+
if (Array.isArray(options.coverageReporters) && options.coverageReporters.length > 0) config.coverageReporters = options.coverageReporters;
|
|
67
|
+
return { test: { jest: config } };
|
|
68
|
+
},
|
|
69
|
+
async test() {
|
|
70
|
+
if (this.config.test.jest) {
|
|
71
|
+
const { results } = await (0, jest.runCLI)(this.config.test.jest, [(0, _stryke_path_join.joinPaths)(this.config.cwd, this.config.root)]);
|
|
72
|
+
const snapshotResults = results.snapshot;
|
|
73
|
+
const snapshotsAdded = snapshotResults.added;
|
|
74
|
+
const snapshotsFailed = snapshotResults.unmatched;
|
|
75
|
+
const snapshotsOutdated = snapshotResults.unchecked;
|
|
76
|
+
const snapshotsFilesRemoved = snapshotResults.filesRemoved;
|
|
77
|
+
const snapshotsDidUpdate = snapshotResults.didUpdate;
|
|
78
|
+
const snapshotsPassed = snapshotResults.matched;
|
|
79
|
+
const snapshotsTotal = snapshotResults.total;
|
|
80
|
+
const snapshotsUpdated = snapshotResults.updated;
|
|
81
|
+
const suitesFailed = results.numFailedTestSuites;
|
|
82
|
+
const suitesPassed = results.numPassedTestSuites;
|
|
83
|
+
const suitesPending = results.numPendingTestSuites;
|
|
84
|
+
const suitesRun = suitesFailed + suitesPassed;
|
|
85
|
+
const suitesTotal = results.testResults.length;
|
|
86
|
+
const testsFailed = results.numFailedTests;
|
|
87
|
+
const testsPassed = results.numPassedTests;
|
|
88
|
+
const testsPending = results.numPendingTests;
|
|
89
|
+
const testsTodo = results.numTodoTests;
|
|
90
|
+
const testsTotal = results.numTotalTests;
|
|
91
|
+
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`;
|
|
92
|
+
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`;
|
|
93
|
+
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`;
|
|
94
|
+
this.info(`
|
|
95
|
+
${chalk.default.bold(`Test result summary:`)}
|
|
96
|
+
${suites}
|
|
97
|
+
${tests}
|
|
98
|
+
${snapshots}
|
|
99
|
+
${chalk.default.bold(`Time:`)} ${(0, jest_util.formatTime)((Date.now() - results.startTime) / 1e3)}
|
|
100
|
+
`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
exports.default = plugin;
|
|
108
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,104 @@
|
|
|
1
|
-
import{joinPaths
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { joinPaths } from "@stryke/path/join";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { runCLI } from "jest";
|
|
4
|
+
import { formatTime, pluralize } from "jest-util";
|
|
5
|
+
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* Jest plugin for Powerlines.
|
|
9
|
+
*
|
|
10
|
+
* @param options - The Jest plugin user configuration options.
|
|
11
|
+
* @returns A Powerlines plugin that integrates Jest testing.
|
|
12
|
+
*/
|
|
13
|
+
const plugin = (options = {}) => {
|
|
14
|
+
return {
|
|
15
|
+
name: "jest",
|
|
16
|
+
async config() {
|
|
17
|
+
const config = {
|
|
18
|
+
$0: void 0,
|
|
19
|
+
_: [],
|
|
20
|
+
coverage: options.codeCoverage,
|
|
21
|
+
bail: options.bail,
|
|
22
|
+
cache: true,
|
|
23
|
+
cacheDirectory: joinPaths(this.cachePath, "jest"),
|
|
24
|
+
ci: options.ci,
|
|
25
|
+
color: options.colors ?? true,
|
|
26
|
+
debug: this.config.mode === "development",
|
|
27
|
+
detectOpenHandles: options.detectOpenHandles,
|
|
28
|
+
forceExit: options.forceExit,
|
|
29
|
+
logHeapUsage: options.logHeapUsage,
|
|
30
|
+
detectLeaks: options.detectLeaks,
|
|
31
|
+
json: options.json,
|
|
32
|
+
maxWorkers: options.maxWorkers,
|
|
33
|
+
onlyChanged: options.onlyChanged,
|
|
34
|
+
changedSince: options.changedSince,
|
|
35
|
+
outputFile: options.outputFile,
|
|
36
|
+
passWithNoTests: options.passWithNoTests,
|
|
37
|
+
runInBand: options.runInBand,
|
|
38
|
+
showConfig: options.showConfig,
|
|
39
|
+
silent: options.silent,
|
|
40
|
+
testLocationInResults: options.testLocationInResults,
|
|
41
|
+
testNamePattern: options.testNamePattern,
|
|
42
|
+
testPathPatterns: options.testPathPatterns,
|
|
43
|
+
testPathIgnorePatterns: options.testPathIgnorePatterns,
|
|
44
|
+
testTimeout: options.testTimeout,
|
|
45
|
+
colors: options.colors ?? true,
|
|
46
|
+
verbose: options.verbose,
|
|
47
|
+
testResultsProcessor: options.testResultsProcessor,
|
|
48
|
+
updateSnapshot: options.updateSnapshot,
|
|
49
|
+
useStderr: options.useStderr,
|
|
50
|
+
watch: options.watch,
|
|
51
|
+
watchAll: options.watchAll,
|
|
52
|
+
randomize: options.randomize
|
|
53
|
+
};
|
|
54
|
+
if (options.testFile) config._.push(options.testFile);
|
|
55
|
+
if (options.findRelatedTests) {
|
|
56
|
+
const parsedTests = options.findRelatedTests.map((s) => s.trim());
|
|
57
|
+
config._.push(...parsedTests);
|
|
58
|
+
config.findRelatedTests = true;
|
|
59
|
+
}
|
|
60
|
+
if (options.coverageDirectory) config.coverageDirectory = joinPaths(this.config.cwd, options.coverageDirectory);
|
|
61
|
+
if (options.clearCache) config.clearCache = true;
|
|
62
|
+
if (options.reporters && options.reporters.length > 0) config.reporters = options.reporters;
|
|
63
|
+
if (Array.isArray(options.coverageReporters) && options.coverageReporters.length > 0) config.coverageReporters = options.coverageReporters;
|
|
64
|
+
return { test: { jest: config } };
|
|
65
|
+
},
|
|
66
|
+
async test() {
|
|
67
|
+
if (this.config.test.jest) {
|
|
68
|
+
const { results } = await runCLI(this.config.test.jest, [joinPaths(this.config.cwd, this.config.root)]);
|
|
69
|
+
const snapshotResults = results.snapshot;
|
|
70
|
+
const snapshotsAdded = snapshotResults.added;
|
|
71
|
+
const snapshotsFailed = snapshotResults.unmatched;
|
|
72
|
+
const snapshotsOutdated = snapshotResults.unchecked;
|
|
73
|
+
const snapshotsFilesRemoved = snapshotResults.filesRemoved;
|
|
74
|
+
const snapshotsDidUpdate = snapshotResults.didUpdate;
|
|
75
|
+
const snapshotsPassed = snapshotResults.matched;
|
|
76
|
+
const snapshotsTotal = snapshotResults.total;
|
|
77
|
+
const snapshotsUpdated = snapshotResults.updated;
|
|
78
|
+
const suitesFailed = results.numFailedTestSuites;
|
|
79
|
+
const suitesPassed = results.numPassedTestSuites;
|
|
80
|
+
const suitesPending = results.numPendingTestSuites;
|
|
81
|
+
const suitesRun = suitesFailed + suitesPassed;
|
|
82
|
+
const suitesTotal = results.testResults.length;
|
|
83
|
+
const testsFailed = results.numFailedTests;
|
|
84
|
+
const testsPassed = results.numPassedTests;
|
|
85
|
+
const testsPending = results.numPendingTests;
|
|
86
|
+
const testsTodo = results.numTodoTests;
|
|
87
|
+
const testsTotal = results.numTotalTests;
|
|
88
|
+
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`;
|
|
89
|
+
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`;
|
|
90
|
+
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`;
|
|
91
|
+
this.info(`
|
|
92
|
+
${chalk.bold(`Test result summary:`)}
|
|
93
|
+
${suites}
|
|
94
|
+
${tests}
|
|
95
|
+
${snapshots}
|
|
96
|
+
${chalk.bold(`Time:`)} ${formatTime((Date.now() - results.startTime) / 1e3)}
|
|
97
|
+
`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { plugin as default, plugin };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.1.466",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing the Jest testing plugin for Powerlines.",
|
|
6
6
|
"repository": {
|
|
@@ -103,14 +103,14 @@
|
|
|
103
103
|
"@jest/schemas": "30.0.5",
|
|
104
104
|
"@jest/types": "30.3.0",
|
|
105
105
|
"@sinclair/typebox": "^0.34.49",
|
|
106
|
-
"powerlines": "^0.46.
|
|
106
|
+
"powerlines": "^0.46.5"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@jest/types": "30.3.0",
|
|
110
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
110
|
+
"@powerlines/plugin-plugin": "^0.12.409",
|
|
111
111
|
"@types/jest": "^30.0.0"
|
|
112
112
|
},
|
|
113
113
|
"publishConfig": { "access": "public" },
|
|
114
114
|
"types": "./dist/index.d.cts",
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "9af888c54e58a82744cc334a6b80da52429fa0ac"
|
|
116
116
|
}
|