@getkist/action-jest 1.0.1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/actions/JestAction/JestAction.d.ts +132 -0
- package/dist/actions/JestAction/JestAction.d.ts.map +1 -0
- package/dist/actions/JestAction/JestAction.js +189 -0
- package/dist/actions/JestAction/JestAction.js.map +1 -0
- package/dist/actions/JestAction/index.d.ts +3 -0
- package/dist/actions/JestAction/index.d.ts.map +1 -0
- package/dist/actions/JestAction/index.js +2 -0
- package/dist/actions/JestAction/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/src/actions/JestAction/JestAction.d.ts +132 -0
- package/dist/src/actions/JestAction/JestAction.d.ts.map +1 -0
- package/dist/src/actions/JestAction/JestAction.js +186 -0
- package/dist/src/actions/JestAction/JestAction.js.map +1 -0
- package/dist/src/actions/JestAction/index.d.ts +3 -0
- package/dist/src/actions/JestAction/index.d.ts.map +1 -0
- package/dist/src/actions/JestAction/index.js +2 -0
- package/dist/src/actions/JestAction/index.js.map +1 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/types/Action.d.ts +48 -0
- package/dist/src/types/Action.d.ts.map +1 -0
- package/dist/src/types/Action.js +38 -0
- package/dist/src/types/Action.js.map +1 -0
- package/dist/types/Action.d.ts +48 -0
- package/dist/types/Action.d.ts.map +1 -0
- package/dist/types/Action.js +38 -0
- package/dist/types/Action.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 kist
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# kist-action-jest
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Action } from "../../types/Action.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the JestAction
|
|
4
|
+
*/
|
|
5
|
+
export interface JestActionOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Path to Jest config file
|
|
8
|
+
*/
|
|
9
|
+
configPath?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Test file patterns to run
|
|
12
|
+
*/
|
|
13
|
+
testMatch?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Specific test files or directories to run
|
|
16
|
+
*/
|
|
17
|
+
testPathPattern?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Run tests in watch mode
|
|
20
|
+
*/
|
|
21
|
+
watch?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Run all tests when watch mode detects changes
|
|
24
|
+
*/
|
|
25
|
+
watchAll?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Generate coverage report
|
|
28
|
+
*/
|
|
29
|
+
coverage?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Coverage reporters to use
|
|
32
|
+
*/
|
|
33
|
+
coverageReporters?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Coverage threshold for branches
|
|
36
|
+
*/
|
|
37
|
+
coverageThresholdBranches?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Coverage threshold for functions
|
|
40
|
+
*/
|
|
41
|
+
coverageThresholdFunctions?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Coverage threshold for lines
|
|
44
|
+
*/
|
|
45
|
+
coverageThresholdLines?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Coverage threshold for statements
|
|
48
|
+
*/
|
|
49
|
+
coverageThresholdStatements?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Run tests serially (not in parallel)
|
|
52
|
+
*/
|
|
53
|
+
runInBand?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Maximum number of workers for parallel runs
|
|
56
|
+
*/
|
|
57
|
+
maxWorkers?: number | string;
|
|
58
|
+
/**
|
|
59
|
+
* Only run tests related to changed files
|
|
60
|
+
*/
|
|
61
|
+
onlyChanged?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Fail fast on first test failure
|
|
64
|
+
*/
|
|
65
|
+
bail?: boolean | number;
|
|
66
|
+
/**
|
|
67
|
+
* Update snapshots
|
|
68
|
+
*/
|
|
69
|
+
updateSnapshot?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Clear mocks between every test
|
|
72
|
+
*/
|
|
73
|
+
clearMocks?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Reset mocks between every test
|
|
76
|
+
*/
|
|
77
|
+
resetMocks?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Verbose output
|
|
80
|
+
*/
|
|
81
|
+
verbose?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Silent mode - prevent tests from printing messages
|
|
84
|
+
*/
|
|
85
|
+
silent?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Pass through additional Jest CLI arguments
|
|
88
|
+
*/
|
|
89
|
+
passWithNoTests?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Detect open handles
|
|
92
|
+
*/
|
|
93
|
+
detectOpenHandles?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Force exit after tests complete
|
|
96
|
+
*/
|
|
97
|
+
forceExit?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Test name pattern to filter tests
|
|
100
|
+
*/
|
|
101
|
+
testNamePattern?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Working directory for running Jest
|
|
104
|
+
*/
|
|
105
|
+
cwd?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Additional Node options (e.g., --experimental-vm-modules)
|
|
108
|
+
*/
|
|
109
|
+
nodeOptions?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Additional environment variables
|
|
112
|
+
*/
|
|
113
|
+
env?: Record<string, string>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Action for running tests using Jest.
|
|
117
|
+
*/
|
|
118
|
+
export declare class JestAction extends Action<JestActionOptions> {
|
|
119
|
+
readonly name = "JestAction";
|
|
120
|
+
describe(): string;
|
|
121
|
+
validateOptions(options: JestActionOptions): boolean;
|
|
122
|
+
execute(options: JestActionOptions): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Build Jest CLI arguments from options
|
|
125
|
+
*/
|
|
126
|
+
private buildArgs;
|
|
127
|
+
/**
|
|
128
|
+
* Run Jest with the given arguments
|
|
129
|
+
*/
|
|
130
|
+
private runJest;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=JestAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,MAAM,CAAC,iBAAiB,CAAC;IACrD,QAAQ,CAAC,IAAI,gBAAgB;IAE7B,QAAQ,IAAI,MAAM;IAIlB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO;IAoC9C,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxD;;OAEG;IACH,OAAO,CAAC,SAAS;IAiHjB;;OAEG;IACH,OAAO,CAAC,OAAO;CAuClB"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Action } from "../../types/Action.js";
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
/**
|
|
4
|
+
* Action for running tests using Jest.
|
|
5
|
+
*/
|
|
6
|
+
export class JestAction extends Action {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.name = "JestAction";
|
|
10
|
+
}
|
|
11
|
+
describe() {
|
|
12
|
+
return "Run tests using Jest test framework";
|
|
13
|
+
}
|
|
14
|
+
validateOptions(options) {
|
|
15
|
+
if (options.maxWorkers !== undefined) {
|
|
16
|
+
if (typeof options.maxWorkers === "number" && options.maxWorkers < 1) {
|
|
17
|
+
this.logError("Invalid options: 'maxWorkers' must be at least 1");
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (typeof options.maxWorkers === "string" && !/^\d+%?$/.test(options.maxWorkers)) {
|
|
21
|
+
this.logError("Invalid options: 'maxWorkers' must be a number or percentage string (e.g., '50%')");
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (options.bail !== undefined) {
|
|
26
|
+
if (typeof options.bail === "number" && options.bail < 0) {
|
|
27
|
+
this.logError("Invalid options: 'bail' must be a non-negative number");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const thresholds = [
|
|
32
|
+
options.coverageThresholdBranches,
|
|
33
|
+
options.coverageThresholdFunctions,
|
|
34
|
+
options.coverageThresholdLines,
|
|
35
|
+
options.coverageThresholdStatements,
|
|
36
|
+
];
|
|
37
|
+
for (const threshold of thresholds) {
|
|
38
|
+
if (threshold !== undefined && (threshold < 0 || threshold > 100)) {
|
|
39
|
+
this.logError("Invalid options: coverage thresholds must be between 0 and 100");
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
async execute(options) {
|
|
46
|
+
if (!this.validateOptions(options)) {
|
|
47
|
+
throw new Error("Invalid options provided to JestAction");
|
|
48
|
+
}
|
|
49
|
+
const args = this.buildArgs(options);
|
|
50
|
+
const cwd = options.cwd || process.cwd();
|
|
51
|
+
this.logInfo(`Running Jest tests${options.configPath ? ` with config: ${options.configPath}` : ""}`);
|
|
52
|
+
try {
|
|
53
|
+
await this.runJest(args, cwd, options.nodeOptions, options.env);
|
|
54
|
+
this.logInfo("Tests completed successfully");
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
this.logError("Jest tests failed.", error);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build Jest CLI arguments from options
|
|
63
|
+
*/
|
|
64
|
+
buildArgs(options) {
|
|
65
|
+
const args = [];
|
|
66
|
+
if (options.configPath) {
|
|
67
|
+
args.push("--config", options.configPath);
|
|
68
|
+
}
|
|
69
|
+
if (options.testPathPattern) {
|
|
70
|
+
args.push("--testPathPattern", options.testPathPattern);
|
|
71
|
+
}
|
|
72
|
+
if (options.testNamePattern) {
|
|
73
|
+
args.push("--testNamePattern", options.testNamePattern);
|
|
74
|
+
}
|
|
75
|
+
if (options.watch) {
|
|
76
|
+
args.push("--watch");
|
|
77
|
+
}
|
|
78
|
+
if (options.watchAll) {
|
|
79
|
+
args.push("--watchAll");
|
|
80
|
+
}
|
|
81
|
+
if (options.coverage) {
|
|
82
|
+
args.push("--coverage");
|
|
83
|
+
}
|
|
84
|
+
if (options.coverageReporters && options.coverageReporters.length > 0) {
|
|
85
|
+
for (const reporter of options.coverageReporters) {
|
|
86
|
+
args.push("--coverageReporters", reporter);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (options.runInBand) {
|
|
90
|
+
args.push("--runInBand");
|
|
91
|
+
}
|
|
92
|
+
if (options.maxWorkers !== undefined) {
|
|
93
|
+
args.push("--maxWorkers", String(options.maxWorkers));
|
|
94
|
+
}
|
|
95
|
+
if (options.onlyChanged) {
|
|
96
|
+
args.push("--onlyChanged");
|
|
97
|
+
}
|
|
98
|
+
if (options.bail !== undefined) {
|
|
99
|
+
if (typeof options.bail === "boolean") {
|
|
100
|
+
if (options.bail)
|
|
101
|
+
args.push("--bail");
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
args.push("--bail", String(options.bail));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (options.updateSnapshot) {
|
|
108
|
+
args.push("--updateSnapshot");
|
|
109
|
+
}
|
|
110
|
+
if (options.clearMocks) {
|
|
111
|
+
args.push("--clearMocks");
|
|
112
|
+
}
|
|
113
|
+
if (options.resetMocks) {
|
|
114
|
+
args.push("--resetMocks");
|
|
115
|
+
}
|
|
116
|
+
if (options.verbose) {
|
|
117
|
+
args.push("--verbose");
|
|
118
|
+
}
|
|
119
|
+
if (options.silent) {
|
|
120
|
+
args.push("--silent");
|
|
121
|
+
}
|
|
122
|
+
if (options.passWithNoTests) {
|
|
123
|
+
args.push("--passWithNoTests");
|
|
124
|
+
}
|
|
125
|
+
if (options.detectOpenHandles) {
|
|
126
|
+
args.push("--detectOpenHandles");
|
|
127
|
+
}
|
|
128
|
+
if (options.forceExit) {
|
|
129
|
+
args.push("--forceExit");
|
|
130
|
+
}
|
|
131
|
+
// Handle coverage thresholds
|
|
132
|
+
const hasThresholds = [
|
|
133
|
+
options.coverageThresholdBranches,
|
|
134
|
+
options.coverageThresholdFunctions,
|
|
135
|
+
options.coverageThresholdLines,
|
|
136
|
+
options.coverageThresholdStatements,
|
|
137
|
+
].some(t => t !== undefined);
|
|
138
|
+
if (hasThresholds) {
|
|
139
|
+
const thresholds = {};
|
|
140
|
+
if (options.coverageThresholdBranches !== undefined) {
|
|
141
|
+
thresholds.branches = options.coverageThresholdBranches;
|
|
142
|
+
}
|
|
143
|
+
if (options.coverageThresholdFunctions !== undefined) {
|
|
144
|
+
thresholds.functions = options.coverageThresholdFunctions;
|
|
145
|
+
}
|
|
146
|
+
if (options.coverageThresholdLines !== undefined) {
|
|
147
|
+
thresholds.lines = options.coverageThresholdLines;
|
|
148
|
+
}
|
|
149
|
+
if (options.coverageThresholdStatements !== undefined) {
|
|
150
|
+
thresholds.statements = options.coverageThresholdStatements;
|
|
151
|
+
}
|
|
152
|
+
args.push("--coverageThreshold", JSON.stringify({ global: thresholds }));
|
|
153
|
+
}
|
|
154
|
+
return args;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Run Jest with the given arguments
|
|
158
|
+
*/
|
|
159
|
+
runJest(args, cwd, nodeOptions, env) {
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
const jestBin = require.resolve("jest/bin/jest.js");
|
|
162
|
+
const spawnEnv = {
|
|
163
|
+
...process.env,
|
|
164
|
+
...env,
|
|
165
|
+
};
|
|
166
|
+
if (nodeOptions) {
|
|
167
|
+
spawnEnv.NODE_OPTIONS = nodeOptions;
|
|
168
|
+
}
|
|
169
|
+
this.logDebug(`Running: node ${jestBin} ${args.join(" ")}`);
|
|
170
|
+
const child = spawn("node", [jestBin, ...args], {
|
|
171
|
+
cwd,
|
|
172
|
+
env: spawnEnv,
|
|
173
|
+
stdio: "inherit",
|
|
174
|
+
});
|
|
175
|
+
child.on("close", (code) => {
|
|
176
|
+
if (code === 0) {
|
|
177
|
+
resolve();
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
reject(new Error(`Jest exited with code ${code}`));
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
child.on("error", (error) => {
|
|
184
|
+
reject(error);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=JestAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JestAction.js","sourceRoot":"","sources":["../../../src/actions/JestAction/JestAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AA8ItC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAyB;IAAzD;;QACa,SAAI,GAAG,YAAY,CAAC;IA2NjC,CAAC;IAzNG,QAAQ;QACJ,OAAO,qCAAqC,CAAC;IACjD,CAAC;IAED,eAAe,CAAC,OAA0B;QACtC,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;gBACnE,IAAI,CAAC,QAAQ,CAAC,kDAAkD,CAAC,CAAC;gBAClE,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,U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P,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/JestAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/JestAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JestAction } from "./actions/JestAction/index.js";
|
|
2
|
+
export { JestAction } from "./actions/JestAction/index.js";
|
|
3
|
+
export type { JestActionOptions } from "./actions/JestAction/index.js";
|
|
4
|
+
export { Action } from "./types/Action.js";
|
|
5
|
+
/**
|
|
6
|
+
* Plugin definition for kist
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
actions: {
|
|
12
|
+
JestAction: JestAction;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;;;;;;;;AACH,wBAME"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JestAction } from "./actions/JestAction/index.js";
|
|
2
|
+
export { JestAction } from "./actions/JestAction/index.js";
|
|
3
|
+
export { Action } from "./types/Action.js";
|
|
4
|
+
/**
|
|
5
|
+
* Plugin definition for kist
|
|
6
|
+
*/
|
|
7
|
+
export default {
|
|
8
|
+
name: "@getkist/action-jest",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
actions: {
|
|
11
|
+
JestAction: new JestAction(),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,eAAe;IACX,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE;QACL,UAAU,EAAE,IAAI,UAAU,EAAE;KAC/B;CACJ,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Action } from "../../types/Action.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the JestAction
|
|
4
|
+
*/
|
|
5
|
+
export interface JestActionOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Path to Jest config file
|
|
8
|
+
*/
|
|
9
|
+
configPath?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Test file patterns to run
|
|
12
|
+
*/
|
|
13
|
+
testMatch?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Specific test files or directories to run
|
|
16
|
+
*/
|
|
17
|
+
testPathPattern?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Run tests in watch mode
|
|
20
|
+
*/
|
|
21
|
+
watch?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Run all tests when watch mode detects changes
|
|
24
|
+
*/
|
|
25
|
+
watchAll?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Generate coverage report
|
|
28
|
+
*/
|
|
29
|
+
coverage?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Coverage reporters to use
|
|
32
|
+
*/
|
|
33
|
+
coverageReporters?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Coverage threshold for branches
|
|
36
|
+
*/
|
|
37
|
+
coverageThresholdBranches?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Coverage threshold for functions
|
|
40
|
+
*/
|
|
41
|
+
coverageThresholdFunctions?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Coverage threshold for lines
|
|
44
|
+
*/
|
|
45
|
+
coverageThresholdLines?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Coverage threshold for statements
|
|
48
|
+
*/
|
|
49
|
+
coverageThresholdStatements?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Run tests serially (not in parallel)
|
|
52
|
+
*/
|
|
53
|
+
runInBand?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Maximum number of workers for parallel runs
|
|
56
|
+
*/
|
|
57
|
+
maxWorkers?: number | string;
|
|
58
|
+
/**
|
|
59
|
+
* Only run tests related to changed files
|
|
60
|
+
*/
|
|
61
|
+
onlyChanged?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Fail fast on first test failure
|
|
64
|
+
*/
|
|
65
|
+
bail?: boolean | number;
|
|
66
|
+
/**
|
|
67
|
+
* Update snapshots
|
|
68
|
+
*/
|
|
69
|
+
updateSnapshot?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Clear mocks between every test
|
|
72
|
+
*/
|
|
73
|
+
clearMocks?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Reset mocks between every test
|
|
76
|
+
*/
|
|
77
|
+
resetMocks?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Verbose output
|
|
80
|
+
*/
|
|
81
|
+
verbose?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Silent mode - prevent tests from printing messages
|
|
84
|
+
*/
|
|
85
|
+
silent?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Pass through additional Jest CLI arguments
|
|
88
|
+
*/
|
|
89
|
+
passWithNoTests?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Detect open handles
|
|
92
|
+
*/
|
|
93
|
+
detectOpenHandles?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Force exit after tests complete
|
|
96
|
+
*/
|
|
97
|
+
forceExit?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Test name pattern to filter tests
|
|
100
|
+
*/
|
|
101
|
+
testNamePattern?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Working directory for running Jest
|
|
104
|
+
*/
|
|
105
|
+
cwd?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Additional Node options (e.g., --experimental-vm-modules)
|
|
108
|
+
*/
|
|
109
|
+
nodeOptions?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Additional environment variables
|
|
112
|
+
*/
|
|
113
|
+
env?: Record<string, string>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Action for running tests using Jest.
|
|
117
|
+
*/
|
|
118
|
+
export declare class JestAction extends Action<JestActionOptions> {
|
|
119
|
+
readonly name = "JestAction";
|
|
120
|
+
describe(): string;
|
|
121
|
+
validateOptions(options: JestActionOptions): boolean;
|
|
122
|
+
execute(options: JestActionOptions): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Build Jest CLI arguments from options
|
|
125
|
+
*/
|
|
126
|
+
private buildArgs;
|
|
127
|
+
/**
|
|
128
|
+
* Run Jest with the given arguments
|
|
129
|
+
*/
|
|
130
|
+
private runJest;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=JestAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JestAction.d.ts","sourceRoot":"","sources":["../../../../src/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AAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,MAAM,CAAC,iBAAiB,CAAC;IACrD,QAAQ,CAAC,IAAI,gBAAgB;IAE7B,QAAQ,IAAI,MAAM;IAIlB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO;IAoC9C,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxD;;OAEG;IACH,OAAO,CAAC,SAAS;IAiHjB;;OAEG;IACH,OAAO,CAAC,OAAO;CAuClB"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Action } from "../../types/Action.js";
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
/**
|
|
4
|
+
* Action for running tests using Jest.
|
|
5
|
+
*/
|
|
6
|
+
export class JestAction extends Action {
|
|
7
|
+
name = "JestAction";
|
|
8
|
+
describe() {
|
|
9
|
+
return "Run tests using Jest test framework";
|
|
10
|
+
}
|
|
11
|
+
validateOptions(options) {
|
|
12
|
+
if (options.maxWorkers !== undefined) {
|
|
13
|
+
if (typeof options.maxWorkers === "number" && options.maxWorkers < 1) {
|
|
14
|
+
this.logError("Invalid options: 'maxWorkers' must be at least 1");
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (typeof options.maxWorkers === "string" && !/^\d+%?$/.test(options.maxWorkers)) {
|
|
18
|
+
this.logError("Invalid options: 'maxWorkers' must be a number or percentage string (e.g., '50%')");
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (options.bail !== undefined) {
|
|
23
|
+
if (typeof options.bail === "number" && options.bail < 0) {
|
|
24
|
+
this.logError("Invalid options: 'bail' must be a non-negative number");
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const thresholds = [
|
|
29
|
+
options.coverageThresholdBranches,
|
|
30
|
+
options.coverageThresholdFunctions,
|
|
31
|
+
options.coverageThresholdLines,
|
|
32
|
+
options.coverageThresholdStatements,
|
|
33
|
+
];
|
|
34
|
+
for (const threshold of thresholds) {
|
|
35
|
+
if (threshold !== undefined && (threshold < 0 || threshold > 100)) {
|
|
36
|
+
this.logError("Invalid options: coverage thresholds must be between 0 and 100");
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
async execute(options) {
|
|
43
|
+
if (!this.validateOptions(options)) {
|
|
44
|
+
throw new Error("Invalid options provided to JestAction");
|
|
45
|
+
}
|
|
46
|
+
const args = this.buildArgs(options);
|
|
47
|
+
const cwd = options.cwd || process.cwd();
|
|
48
|
+
this.logInfo(`Running Jest tests${options.configPath ? ` with config: ${options.configPath}` : ""}`);
|
|
49
|
+
try {
|
|
50
|
+
await this.runJest(args, cwd, options.nodeOptions, options.env);
|
|
51
|
+
this.logInfo("Tests completed successfully");
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.logError("Jest tests failed.", error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build Jest CLI arguments from options
|
|
60
|
+
*/
|
|
61
|
+
buildArgs(options) {
|
|
62
|
+
const args = [];
|
|
63
|
+
if (options.configPath) {
|
|
64
|
+
args.push("--config", options.configPath);
|
|
65
|
+
}
|
|
66
|
+
if (options.testPathPattern) {
|
|
67
|
+
args.push("--testPathPattern", options.testPathPattern);
|
|
68
|
+
}
|
|
69
|
+
if (options.testNamePattern) {
|
|
70
|
+
args.push("--testNamePattern", options.testNamePattern);
|
|
71
|
+
}
|
|
72
|
+
if (options.watch) {
|
|
73
|
+
args.push("--watch");
|
|
74
|
+
}
|
|
75
|
+
if (options.watchAll) {
|
|
76
|
+
args.push("--watchAll");
|
|
77
|
+
}
|
|
78
|
+
if (options.coverage) {
|
|
79
|
+
args.push("--coverage");
|
|
80
|
+
}
|
|
81
|
+
if (options.coverageReporters && options.coverageReporters.length > 0) {
|
|
82
|
+
for (const reporter of options.coverageReporters) {
|
|
83
|
+
args.push("--coverageReporters", reporter);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (options.runInBand) {
|
|
87
|
+
args.push("--runInBand");
|
|
88
|
+
}
|
|
89
|
+
if (options.maxWorkers !== undefined) {
|
|
90
|
+
args.push("--maxWorkers", String(options.maxWorkers));
|
|
91
|
+
}
|
|
92
|
+
if (options.onlyChanged) {
|
|
93
|
+
args.push("--onlyChanged");
|
|
94
|
+
}
|
|
95
|
+
if (options.bail !== undefined) {
|
|
96
|
+
if (typeof options.bail === "boolean") {
|
|
97
|
+
if (options.bail)
|
|
98
|
+
args.push("--bail");
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
args.push("--bail", String(options.bail));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (options.updateSnapshot) {
|
|
105
|
+
args.push("--updateSnapshot");
|
|
106
|
+
}
|
|
107
|
+
if (options.clearMocks) {
|
|
108
|
+
args.push("--clearMocks");
|
|
109
|
+
}
|
|
110
|
+
if (options.resetMocks) {
|
|
111
|
+
args.push("--resetMocks");
|
|
112
|
+
}
|
|
113
|
+
if (options.verbose) {
|
|
114
|
+
args.push("--verbose");
|
|
115
|
+
}
|
|
116
|
+
if (options.silent) {
|
|
117
|
+
args.push("--silent");
|
|
118
|
+
}
|
|
119
|
+
if (options.passWithNoTests) {
|
|
120
|
+
args.push("--passWithNoTests");
|
|
121
|
+
}
|
|
122
|
+
if (options.detectOpenHandles) {
|
|
123
|
+
args.push("--detectOpenHandles");
|
|
124
|
+
}
|
|
125
|
+
if (options.forceExit) {
|
|
126
|
+
args.push("--forceExit");
|
|
127
|
+
}
|
|
128
|
+
// Handle coverage thresholds
|
|
129
|
+
const hasThresholds = [
|
|
130
|
+
options.coverageThresholdBranches,
|
|
131
|
+
options.coverageThresholdFunctions,
|
|
132
|
+
options.coverageThresholdLines,
|
|
133
|
+
options.coverageThresholdStatements,
|
|
134
|
+
].some(t => t !== undefined);
|
|
135
|
+
if (hasThresholds) {
|
|
136
|
+
const thresholds = {};
|
|
137
|
+
if (options.coverageThresholdBranches !== undefined) {
|
|
138
|
+
thresholds.branches = options.coverageThresholdBranches;
|
|
139
|
+
}
|
|
140
|
+
if (options.coverageThresholdFunctions !== undefined) {
|
|
141
|
+
thresholds.functions = options.coverageThresholdFunctions;
|
|
142
|
+
}
|
|
143
|
+
if (options.coverageThresholdLines !== undefined) {
|
|
144
|
+
thresholds.lines = options.coverageThresholdLines;
|
|
145
|
+
}
|
|
146
|
+
if (options.coverageThresholdStatements !== undefined) {
|
|
147
|
+
thresholds.statements = options.coverageThresholdStatements;
|
|
148
|
+
}
|
|
149
|
+
args.push("--coverageThreshold", JSON.stringify({ global: thresholds }));
|
|
150
|
+
}
|
|
151
|
+
return args;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Run Jest with the given arguments
|
|
155
|
+
*/
|
|
156
|
+
runJest(args, cwd, nodeOptions, env) {
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
const jestBin = require.resolve("jest/bin/jest.js");
|
|
159
|
+
const spawnEnv = {
|
|
160
|
+
...process.env,
|
|
161
|
+
...env,
|
|
162
|
+
};
|
|
163
|
+
if (nodeOptions) {
|
|
164
|
+
spawnEnv.NODE_OPTIONS = nodeOptions;
|
|
165
|
+
}
|
|
166
|
+
this.logDebug(`Running: node ${jestBin} ${args.join(" ")}`);
|
|
167
|
+
const child = spawn("node", [jestBin, ...args], {
|
|
168
|
+
cwd,
|
|
169
|
+
env: spawnEnv,
|
|
170
|
+
stdio: "inherit",
|
|
171
|
+
});
|
|
172
|
+
child.on("close", (code) => {
|
|
173
|
+
if (code === 0) {
|
|
174
|
+
resolve();
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
reject(new Error(`Jest exited with code ${code}`));
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
child.on("error", (error) => {
|
|
181
|
+
reject(error);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=JestAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JestAction.js","sourceRoot":"","sources":["../../../../src/actions/JestAction/JestAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AA8ItC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAyB;IAC5C,IAAI,GAAG,YAAY,CAAC;IAE7B,QAAQ;QACJ,OAAO,qCAAqC,CAAC;IACjD,CAAC;IAED,eAAe,CAAC,OAA0B;QACtC,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;gBACnE,IAAI,CAAC,QAAQ,CAAC,kDAAkD,CAAC,CAAC;gBAClE,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChF,IAAI,CAAC,QAAQ,CAAC,mFAAmF,CAAC,CAAC;gBACnG,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;Q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Action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/JestAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JestAction } from "./actions/JestAction/index.js";
|
|
2
|
+
export { JestAction } from "./actions/JestAction/index.js";
|
|
3
|
+
export type { JestActionOptions } from "./actions/JestAction/index.js";
|
|
4
|
+
export { Action } from "./types/Action.js";
|
|
5
|
+
/**
|
|
6
|
+
* Plugin definition for kist
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
actions: {
|
|
12
|
+
JestAction: JestAction;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;;;;;;;;AACH,wBAME"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JestAction } from "./actions/JestAction/index.js";
|
|
2
|
+
export { JestAction } from "./actions/JestAction/index.js";
|
|
3
|
+
export { Action } from "./types/Action.js";
|
|
4
|
+
/**
|
|
5
|
+
* Plugin definition for kist
|
|
6
|
+
*/
|
|
7
|
+
export default {
|
|
8
|
+
name: "@getkist/action-jest",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
actions: {
|
|
11
|
+
JestAction: new JestAction(),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,eAAe;IACX,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE;QACL,UAAU,EAAE,IAAI,UAAU,EAAE;KAC/B;CACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for kist actions.
|
|
3
|
+
* Provides common functionality for all action implementations.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class Action<TOptions = Record<string, unknown>> {
|
|
6
|
+
/**
|
|
7
|
+
* The unique name of this action.
|
|
8
|
+
*/
|
|
9
|
+
abstract readonly name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a human-readable description of what this action does.
|
|
12
|
+
*/
|
|
13
|
+
abstract describe(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Validates the provided options before execution.
|
|
16
|
+
* @param options - The options to validate
|
|
17
|
+
* @returns true if options are valid, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
abstract validateOptions(options: TOptions): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Executes the action with the provided options.
|
|
22
|
+
* @param options - The options for this action
|
|
23
|
+
* @returns A promise that resolves when the action completes
|
|
24
|
+
*/
|
|
25
|
+
abstract execute(options: TOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Logs an informational message.
|
|
28
|
+
* @param message - The message to log
|
|
29
|
+
*/
|
|
30
|
+
protected logInfo(message: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Logs a warning message.
|
|
33
|
+
* @param message - The message to log
|
|
34
|
+
*/
|
|
35
|
+
protected logWarning(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Logs an error message.
|
|
38
|
+
* @param message - The message to log
|
|
39
|
+
* @param error - Optional error object
|
|
40
|
+
*/
|
|
41
|
+
protected logError(message: string, error?: unknown): void;
|
|
42
|
+
/**
|
|
43
|
+
* Logs a debug message.
|
|
44
|
+
* @param message - The message to log
|
|
45
|
+
*/
|
|
46
|
+
protected logDebug(message: string): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=Action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAEpD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElD;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAK5C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for kist actions.
|
|
3
|
+
* Provides common functionality for all action implementations.
|
|
4
|
+
*/
|
|
5
|
+
export class Action {
|
|
6
|
+
/**
|
|
7
|
+
* Logs an informational message.
|
|
8
|
+
* @param message - The message to log
|
|
9
|
+
*/
|
|
10
|
+
logInfo(message) {
|
|
11
|
+
console.log(`[${this.name}] ${message}`);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Logs a warning message.
|
|
15
|
+
* @param message - The message to log
|
|
16
|
+
*/
|
|
17
|
+
logWarning(message) {
|
|
18
|
+
console.warn(`[${this.name}] WARNING: ${message}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Logs an error message.
|
|
22
|
+
* @param message - The message to log
|
|
23
|
+
* @param error - Optional error object
|
|
24
|
+
*/
|
|
25
|
+
logError(message, error) {
|
|
26
|
+
console.error(`[${this.name}] ERROR: ${message}`, error || "");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Logs a debug message.
|
|
30
|
+
* @param message - The message to log
|
|
31
|
+
*/
|
|
32
|
+
logDebug(message) {
|
|
33
|
+
if (process.env.DEBUG) {
|
|
34
|
+
console.debug(`[${this.name}] DEBUG: ${message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,MAAM;IAyBxB;;;OAGG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACO,QAAQ,CAAC,OAAe,EAAE,KAAe;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,OAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for kist actions.
|
|
3
|
+
* Provides common functionality for all action implementations.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class Action<TOptions = Record<string, unknown>> {
|
|
6
|
+
/**
|
|
7
|
+
* The unique name of this action.
|
|
8
|
+
*/
|
|
9
|
+
abstract readonly name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a human-readable description of what this action does.
|
|
12
|
+
*/
|
|
13
|
+
abstract describe(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Validates the provided options before execution.
|
|
16
|
+
* @param options - The options to validate
|
|
17
|
+
* @returns true if options are valid, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
abstract validateOptions(options: TOptions): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Executes the action with the provided options.
|
|
22
|
+
* @param options - The options for this action
|
|
23
|
+
* @returns A promise that resolves when the action completes
|
|
24
|
+
*/
|
|
25
|
+
abstract execute(options: TOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Logs an informational message.
|
|
28
|
+
* @param message - The message to log
|
|
29
|
+
*/
|
|
30
|
+
protected logInfo(message: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Logs a warning message.
|
|
33
|
+
* @param message - The message to log
|
|
34
|
+
*/
|
|
35
|
+
protected logWarning(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Logs an error message.
|
|
38
|
+
* @param message - The message to log
|
|
39
|
+
* @param error - Optional error object
|
|
40
|
+
*/
|
|
41
|
+
protected logError(message: string, error?: unknown): void;
|
|
42
|
+
/**
|
|
43
|
+
* Logs a debug message.
|
|
44
|
+
* @param message - The message to log
|
|
45
|
+
*/
|
|
46
|
+
protected logDebug(message: string): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=Action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAEpD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElD;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAK5C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for kist actions.
|
|
3
|
+
* Provides common functionality for all action implementations.
|
|
4
|
+
*/
|
|
5
|
+
export class Action {
|
|
6
|
+
/**
|
|
7
|
+
* Logs an informational message.
|
|
8
|
+
* @param message - The message to log
|
|
9
|
+
*/
|
|
10
|
+
logInfo(message) {
|
|
11
|
+
console.log(`[${this.name}] ${message}`);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Logs a warning message.
|
|
15
|
+
* @param message - The message to log
|
|
16
|
+
*/
|
|
17
|
+
logWarning(message) {
|
|
18
|
+
console.warn(`[${this.name}] WARNING: ${message}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Logs an error message.
|
|
22
|
+
* @param message - The message to log
|
|
23
|
+
* @param error - Optional error object
|
|
24
|
+
*/
|
|
25
|
+
logError(message, error) {
|
|
26
|
+
console.error(`[${this.name}] ERROR: ${message}`, error || "");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Logs a debug message.
|
|
30
|
+
* @param message - The message to log
|
|
31
|
+
*/
|
|
32
|
+
logDebug(message) {
|
|
33
|
+
if (process.env.DEBUG) {
|
|
34
|
+
console.debug(`[${this.name}] DEBUG: ${message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,MAAM;IAyBxB;;;OAGG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACO,QAAQ,CAAC,OAAe,EAAE,KAAe;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,OAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;CACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getkist/action-jest",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Jest test runner action for kist",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
11
|
+
"lint": "eslint src/**/*.ts",
|
|
12
|
+
"prepublishOnly": "npm run build && npm test"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"kist",
|
|
16
|
+
"jest",
|
|
17
|
+
"testing",
|
|
18
|
+
"test-runner",
|
|
19
|
+
"plugin"
|
|
20
|
+
],
|
|
21
|
+
"author": "kist",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/getkist/kist-action-jest.git"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.0.0",
|
|
29
|
+
"npm": ">=10.0.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"jest": "^29.7.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/jest": "^29.5.12",
|
|
36
|
+
"@types/node": "^20.11.0",
|
|
37
|
+
"eslint": "^9.0.0",
|
|
38
|
+
"ts-jest": "^29.1.2",
|
|
39
|
+
"typescript": "^5.3.0",
|
|
40
|
+
"typescript-eslint": "^8.0.0"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|