@powerlines/plugin-jest 0.1.125 → 0.1.127
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 +110 -7
- package/dist/index.mjs +106 -7
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +6 -6
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 =
|
|
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?:
|
|
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?:
|
|
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 =
|
|
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?:
|
|
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?:
|
|
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
|
*
|
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.127",
|
|
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.
|
|
123
|
-
"@stryke/path": "^0.24.
|
|
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.
|
|
130
|
+
"powerlines": "^0.36.24"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": {
|
|
133
133
|
"@jest/types": "^30.2.0",
|
|
134
|
-
"@powerlines/nx": "^0.11.
|
|
134
|
+
"@powerlines/nx": "^0.11.50",
|
|
135
135
|
"@types/jest": "^30.0.0"
|
|
136
136
|
},
|
|
137
137
|
"publishConfig": { "access": "public" },
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "4b695d4b3476fd9dd79521f92258d52dab2b8d72"
|
|
139
139
|
}
|