@smoothbricks/nx-plugin 0.5.6 → 0.5.7
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/README.md +9 -0
- package/dist/executors/all-verdicts/executor.d.ts +35 -0
- package/dist/executors/all-verdicts/executor.d.ts.map +1 -0
- package/dist/executors/all-verdicts/executor.js +133 -0
- package/dist/executors/all-verdicts/schema.d.ts +10 -0
- package/dist/executors/all-verdicts/schema.d.ts.map +1 -0
- package/dist/executors/all-verdicts/schema.js +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/executors.json +5 -0
- package/package.json +1 -1
- package/src/executors/all-verdicts/executor.test.ts +135 -0
- package/src/executors/all-verdicts/executor.ts +164 -0
- package/src/executors/all-verdicts/schema.json +22 -0
- package/src/executors/all-verdicts/schema.ts +10 -0
- package/src/index.test.ts +7 -5
- package/src/index.ts +4 -1
- package/test-timings.json +99 -98
package/README.md
CHANGED
|
@@ -54,6 +54,15 @@ JavaScript/TypeScript sources or changing the declared test program updates lint
|
|
|
54
54
|
`@smoothbricks/nx-plugin/eslint-file-set` owns its type and generated validator; an inspector can resolve each file's
|
|
55
55
|
actual ESLint parser program instead of guessing from the project or target name.
|
|
56
56
|
|
|
57
|
+
The `lint` target runs its commands with this plugin's `all-verdicts` executor, not Nx's `run-commands`, which in
|
|
58
|
+
parallel terminates the other commands once one fails and serially never starts the ones after a failure: one tool's
|
|
59
|
+
errors would hide another's until a later run. `all-verdicts` starts every command at once, and none ends another. Each
|
|
60
|
+
command's output prints as one block when it closes, then every command's verdict: `PASS`, `FAIL (exit n)`, or
|
|
61
|
+
`UNJUDGED` with its cause when a signal ended it, it never started, or the run itself was signalled. A signal to the run
|
|
62
|
+
ends each command's process group, and the run then ends by the same signal. The target passes only when every command
|
|
63
|
+
passed; an empty command list is refused, since it could never fail. The options keep `commands` and `cwd`, so each
|
|
64
|
+
tool's command, the inputs that key it and `metadata.eslintFileSet` are what they were.
|
|
65
|
+
|
|
57
66
|
Lint inputs include dependency production inputs because type-aware ESLint reads dependencies' declarations. This uses
|
|
58
67
|
`^production` unless the workspace opts into the versionless production input described below. Keep
|
|
59
68
|
`targetDefaults.lint` limited to shared cache policy or additive inputs such as `["...", "^production"]`. Smoo's
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AllVerdictsOptions } from './schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* A command's verdict. Only a command that exited reached one. A command a signal ended, one that never started and
|
|
4
|
+
* one still running when the run itself was signalled are unjudged: never a pass, and never left out of the report.
|
|
5
|
+
*/
|
|
6
|
+
export type Verdict = {
|
|
7
|
+
readonly kind: 'pass';
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'fail';
|
|
10
|
+
readonly code: number;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'unjudged';
|
|
13
|
+
readonly cause: string;
|
|
14
|
+
};
|
|
15
|
+
export interface CommandVerdict {
|
|
16
|
+
readonly command: string;
|
|
17
|
+
readonly verdict: Verdict;
|
|
18
|
+
}
|
|
19
|
+
/** The verdict of a process that closed with exit `code`, or, when `code` is null, was ended by `signal`. */
|
|
20
|
+
export declare function closedVerdict(code: number | null, signal: NodeJS.Signals | null): Verdict;
|
|
21
|
+
/** Every command's verdict, in the order the target lists the commands, under a count of each verdict. */
|
|
22
|
+
export declare function verdictReport(verdicts: readonly CommandVerdict[]): string;
|
|
23
|
+
/**
|
|
24
|
+
* Starts every command at once and lets each reach its own verdict. Nx's run-commands cannot: in parallel it terminates
|
|
25
|
+
* the other commands once one fails, and serially it never starts the ones after a failure, so one tool's errors hide
|
|
26
|
+
* another's until a later run. Here no command ends another. Each command's output prints as one block when it closes,
|
|
27
|
+
* then every command's verdict. A signal to the run ends every command's process group, reports each command still
|
|
28
|
+
* running UNJUDGED, and ends the run by the same signal. The run succeeds only when every command passed.
|
|
29
|
+
*/
|
|
30
|
+
export default function allVerdictsExecutor(options: AllVerdictsOptions, context: {
|
|
31
|
+
readonly root: string;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/all-verdicts/executor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,6GAA6G;AAC7G,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,OAAO,CAIzF;AAoBD,0GAA0G;AAC1G,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAQzE;AA6DD;;;;;;GAMG;AACH,wBAA8B,mBAAmB,CAC/C,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAsC/B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
/** The verdict of a process that closed with exit `code`, or, when `code` is null, was ended by `signal`. */
|
|
4
|
+
export function closedVerdict(code, signal) {
|
|
5
|
+
if (code === 0)
|
|
6
|
+
return { kind: 'pass' };
|
|
7
|
+
if (code !== null)
|
|
8
|
+
return { kind: 'fail', code };
|
|
9
|
+
return { kind: 'unjudged', cause: `${signal ?? 'an unreported signal'} ended it before it gave a verdict` };
|
|
10
|
+
}
|
|
11
|
+
/** How much of a command the verdict list quotes; the command's output block names it whole. */
|
|
12
|
+
const LABEL_LENGTH = 120;
|
|
13
|
+
function label(command) {
|
|
14
|
+
return command.length <= LABEL_LENGTH ? command : `${command.slice(0, LABEL_LENGTH - 1)}…`;
|
|
15
|
+
}
|
|
16
|
+
function tag(verdict) {
|
|
17
|
+
switch (verdict.kind) {
|
|
18
|
+
case 'pass':
|
|
19
|
+
return 'PASS';
|
|
20
|
+
case 'fail':
|
|
21
|
+
return `FAIL (exit ${verdict.code})`;
|
|
22
|
+
case 'unjudged':
|
|
23
|
+
return 'UNJUDGED';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Every command's verdict, in the order the target lists the commands, under a count of each verdict. */
|
|
27
|
+
export function verdictReport(verdicts) {
|
|
28
|
+
const count = (kind) => verdicts.filter(({ verdict }) => verdict.kind === kind).length;
|
|
29
|
+
const lines = verdicts.map(({ command, verdict }) => {
|
|
30
|
+
const line = ` ${tag(verdict).padEnd(15)} ${label(command)}`;
|
|
31
|
+
return verdict.kind === 'unjudged' ? `${line} (${verdict.cause})` : line;
|
|
32
|
+
});
|
|
33
|
+
const counts = `${count('pass')} passed, ${count('fail')} failed, ${count('unjudged')} unjudged`;
|
|
34
|
+
return `\nall-verdicts: ${counts} of ${verdicts.length}\n${lines.join('\n')}\n`;
|
|
35
|
+
}
|
|
36
|
+
/** On POSIX each command leads a process group of its own, so a signal reaches every process the command started. */
|
|
37
|
+
const OWN_GROUP = process.platform !== 'win32';
|
|
38
|
+
function signalCommand(pid, signal) {
|
|
39
|
+
try {
|
|
40
|
+
process.kill(OWN_GROUP ? -pid : pid, signal);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
// ESRCH: every process of the command has already exited.
|
|
44
|
+
if (!(error instanceof Error && 'code' in error && error.code === 'ESRCH'))
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const TERMINATION_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
49
|
+
/** A command's output as one block, headed by the command the way Nx's run-commands heads it. */
|
|
50
|
+
function block(run) {
|
|
51
|
+
return `\n> ${run.command}\n\n${run.output.join('')}`;
|
|
52
|
+
}
|
|
53
|
+
/** Starts `run`'s command and settles with its verdict once it closes; its output prints as one block then. */
|
|
54
|
+
function judge(run, cwd) {
|
|
55
|
+
return new Promise((settle) => {
|
|
56
|
+
const close = (verdict) => {
|
|
57
|
+
// A run the signal handler already judged keeps that verdict: the run is ending by the signal.
|
|
58
|
+
if (run.verdict !== null)
|
|
59
|
+
return;
|
|
60
|
+
run.verdict = verdict;
|
|
61
|
+
process.stdout.write(block(run));
|
|
62
|
+
settle(verdict);
|
|
63
|
+
};
|
|
64
|
+
let child;
|
|
65
|
+
try {
|
|
66
|
+
child = spawn(run.command, {
|
|
67
|
+
cwd,
|
|
68
|
+
shell: true,
|
|
69
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
70
|
+
detached: OWN_GROUP,
|
|
71
|
+
windowsHide: true,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
close({ kind: 'unjudged', cause: `it never ran: ${error instanceof Error ? error.message : String(error)}` });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
run.pid = child.pid;
|
|
79
|
+
for (const stream of [child.stdout, child.stderr]) {
|
|
80
|
+
stream.setEncoding('utf8');
|
|
81
|
+
stream.on('data', (text) => run.output.push(text));
|
|
82
|
+
}
|
|
83
|
+
child.once('error', (error) => close({ kind: 'unjudged', cause: `it never ran: ${error.message}` }));
|
|
84
|
+
child.once('close', (code, signal) => close(closedVerdict(code, signal)));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Starts every command at once and lets each reach its own verdict. Nx's run-commands cannot: in parallel it terminates
|
|
89
|
+
* the other commands once one fails, and serially it never starts the ones after a failure, so one tool's errors hide
|
|
90
|
+
* another's until a later run. Here no command ends another. Each command's output prints as one block when it closes,
|
|
91
|
+
* then every command's verdict. A signal to the run ends every command's process group, reports each command still
|
|
92
|
+
* running UNJUDGED, and ends the run by the same signal. The run succeeds only when every command passed.
|
|
93
|
+
*/
|
|
94
|
+
export default async function allVerdictsExecutor(options, context) {
|
|
95
|
+
if (options.commands.length === 0) {
|
|
96
|
+
process.stderr.write('all-verdicts: no commands: an empty set of checks cannot fail, so it cannot pass\n');
|
|
97
|
+
return { success: false };
|
|
98
|
+
}
|
|
99
|
+
const cwd = resolve(context.root, options.cwd);
|
|
100
|
+
const runs = options.commands.map((command) => ({ command, output: [], pid: undefined, verdict: null }));
|
|
101
|
+
const onExit = () => {
|
|
102
|
+
for (const run of runs) {
|
|
103
|
+
if (run.verdict === null && run.pid !== undefined)
|
|
104
|
+
signalCommand(run.pid, 'SIGTERM');
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const onSignal = (signal) => {
|
|
108
|
+
detach();
|
|
109
|
+
const verdicts = runs.map((run) => {
|
|
110
|
+
if (run.verdict === null) {
|
|
111
|
+
if (run.pid !== undefined)
|
|
112
|
+
signalCommand(run.pid, signal);
|
|
113
|
+
run.verdict = { kind: 'unjudged', cause: `the run received ${signal} before it gave a verdict` };
|
|
114
|
+
process.stdout.write(block(run));
|
|
115
|
+
}
|
|
116
|
+
return { command: run.command, verdict: run.verdict };
|
|
117
|
+
});
|
|
118
|
+
process.stdout.write(verdictReport(verdicts), () => process.kill(process.pid, signal));
|
|
119
|
+
};
|
|
120
|
+
const listeners = TERMINATION_SIGNALS.map((signal) => [signal, () => onSignal(signal)]);
|
|
121
|
+
const detach = () => {
|
|
122
|
+
process.removeListener('exit', onExit);
|
|
123
|
+
for (const [signal, listener] of listeners)
|
|
124
|
+
process.removeListener(signal, listener);
|
|
125
|
+
};
|
|
126
|
+
process.on('exit', onExit);
|
|
127
|
+
for (const [signal, listener] of listeners)
|
|
128
|
+
process.on(signal, listener);
|
|
129
|
+
const verdicts = await Promise.all(runs.map(async (run) => ({ command: run.command, verdict: await judge(run, cwd) })));
|
|
130
|
+
detach();
|
|
131
|
+
process.stdout.write(verdictReport(verdicts));
|
|
132
|
+
return { success: verdicts.every(({ verdict }) => verdict.kind === 'pass') };
|
|
133
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The executor the inferred `lint` target runs its tool commands with. */
|
|
2
|
+
export declare const ALL_VERDICTS_EXECUTOR = "@smoothbricks/nx-plugin:all-verdicts";
|
|
3
|
+
/** Options of `@smoothbricks/nx-plugin:all-verdicts`. */
|
|
4
|
+
export interface AllVerdictsOptions {
|
|
5
|
+
/** Shell commands, all started at once; none ends another. An empty list is refused: it could never fail. */
|
|
6
|
+
readonly commands: readonly string[];
|
|
7
|
+
/** Where every command runs, relative to the workspace root. */
|
|
8
|
+
readonly cwd: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/executors/all-verdicts/schema.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,yCAAyC,CAAC;AAE5E,yDAAyD;AACzD,MAAM,WAAW,kBAAkB;IACjC,6GAA6G;IAC7G,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAkBlC,OAAO,EAKL,yBAAyB,EAiB1B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAkBlC,OAAO,EAKL,yBAAyB,EAiB1B,MAAM,sBAAsB,CAAC;AAuB9B,OAAO,EACL,KAAK,uBAAuB,EAG7B,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,gEAAgE;AAChE,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAmyBlD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,UAAsB,GAC9B,MAAM,EAAE,CAKV;AAkID,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,CAEvG;AAED,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC;AAeF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,uBAAuB,CAOxE,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,kBAAkB,CAAC,uBAAuB,CAI1E,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { CARGO_CLOSURE_INPUT, cargoClosureInputs, indexedCargoManifests, resolve
|
|
|
12
12
|
import { CARGO_TOOLCHAIN_NAMED_INPUT, CARGO_TOOLCHAIN_PIN_INPUTS, cargoRuntimeInput, } from './cargo-toolchain-policy.js';
|
|
13
13
|
import { attributeCargoWorkspacePackages, CARGO_TEST_ARCHIVE_FILE, CARGO_TEST_ARCHIVE_TARGET, CARGO_TEST_COMPILE_TARGET, CARGO_TEST_EXCEPTIONS_SUFFIX, CARGO_TEST_TARGET, cargoPackageTestInputs, cargoTestGroupTargetName, cargoTestPackageTargetName, createCargoInputsCache, exceptionalTestFilter, listCargoCrossTestTargets, listCargoWorkspacePackages, NEXTEST_REPO_CONFIG_PATH, nextestToolConfigArg, PLUGIN_NEXTEST_CONFIG_PATH, serialTestGroups, } from './cargo-workspace.js';
|
|
14
14
|
import { CARGO_CROSS_LINT_COMMAND, CARGO_CROSS_LINT_TARGET, CARGO_FETCH_COMMAND, CARGO_FETCH_TARGET, CARGO_LINT_CLIPPY_COMMAND, cargoCrossTestArchiveFile, cargoCrossTestArchiveTargetName, cargoCrossTestTargetName, cargoFrozen, runsFrozenCargo, } from './cross-check-policy.js';
|
|
15
|
+
import { ALL_VERDICTS_EXECUTOR } from './executors/all-verdicts/schema.js';
|
|
15
16
|
import { closeRunCpuPool, serveRunCpuPool } from './executors/bounded-exec/run-cpu-pool.js';
|
|
16
17
|
import { hashVersionlessCrateManifests } from './manifest-hash.js';
|
|
17
18
|
import { EXTRACTED_BINARIES_METADATA, EXTRACTED_CARGO_METADATA, EXTRACTED_TARGET_DIR, NEXTEST_EXTRACT_BIN, } from './nextest-extraction.js';
|
|
@@ -1594,9 +1595,11 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1594
1595
|
validationTargets.push(SHARD_TIMINGS_TARGET);
|
|
1595
1596
|
}
|
|
1596
1597
|
const { commands: lintCommands, inputs: lintProgramInputs, eslintFileSet, } = projectLintCommands(projectRoot, workspaceRoot, eslintSources);
|
|
1598
|
+
// Every lint tool reaches its own verdict in one run: run-commands would end the
|
|
1599
|
+
// other tools once one fails, and their findings would surface a run later.
|
|
1597
1600
|
if (validationTargets.length > 0 || lintCommands.length > 0) {
|
|
1598
1601
|
targets.lint = {
|
|
1599
|
-
executor: lintCommands.length > 0 ?
|
|
1602
|
+
executor: lintCommands.length > 0 ? ALL_VERDICTS_EXECUTOR : 'nx:noop',
|
|
1600
1603
|
...(eslintFileSet === null ? {} : { metadata: { eslintFileSet } }),
|
|
1601
1604
|
cache: true,
|
|
1602
1605
|
dependsOn: validationTargets,
|
package/executors.json
CHANGED
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"implementation": "./dist/executors/shard-timings/executor.js",
|
|
25
25
|
"schema": "./src/executors/shard-timings/schema.json",
|
|
26
26
|
"description": "Fail when a timings-sharded bun test suite runs a file its --timings manifest does not name"
|
|
27
|
+
},
|
|
28
|
+
"all-verdicts": {
|
|
29
|
+
"implementation": "./dist/executors/all-verdicts/executor.js",
|
|
30
|
+
"schema": "./src/executors/all-verdicts/schema.json",
|
|
31
|
+
"description": "Run every command at once to its own verdict and report each one a signal ended or that never ran as UNJUDGED"
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
+
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
import allVerdictsExecutor, { verdictReport } from './executor.js';
|
|
9
|
+
|
|
10
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const executorModule = join(here, 'executor.ts');
|
|
12
|
+
const repoRoot = resolve(here, '../../../../..');
|
|
13
|
+
/** The workspace's own installed tool, quoted for the shell. */
|
|
14
|
+
const tool = (name: string): string => `'${join(repoRoot, 'node_modules', '.bin', name)}'`;
|
|
15
|
+
|
|
16
|
+
interface Finished {
|
|
17
|
+
readonly stdout: string;
|
|
18
|
+
readonly stderr: string;
|
|
19
|
+
readonly code: number | null;
|
|
20
|
+
readonly signal: NodeJS.Signals | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The executor in a process of its own, as Nx runs it: how it ended, and a wait for text it prints. */
|
|
24
|
+
function startExecutor(root: string, commands: readonly string[], cwd = '.') {
|
|
25
|
+
const script = [
|
|
26
|
+
`const { default: run } = await import(${JSON.stringify(executorModule)});`,
|
|
27
|
+
`const { success } = await run(${JSON.stringify({ commands, cwd })}, { root: ${JSON.stringify(root)} });`,
|
|
28
|
+
'process.exitCode = success ? 0 : 1;',
|
|
29
|
+
].join('\n');
|
|
30
|
+
const child = spawn(process.execPath, ['--eval', script], { cwd: root, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
31
|
+
let stdout = '';
|
|
32
|
+
let stderr = '';
|
|
33
|
+
const waits: { readonly text: string; readonly printed: () => void }[] = [];
|
|
34
|
+
child.stdout.setEncoding('utf8');
|
|
35
|
+
child.stdout.on('data', (text: string) => {
|
|
36
|
+
stdout += text;
|
|
37
|
+
for (const wait of waits) if (stdout.includes(wait.text)) wait.printed();
|
|
38
|
+
});
|
|
39
|
+
child.stderr.setEncoding('utf8');
|
|
40
|
+
child.stderr.on('data', (text: string) => {
|
|
41
|
+
stderr += text;
|
|
42
|
+
});
|
|
43
|
+
const finished = new Promise<Finished>((settle) => {
|
|
44
|
+
child.once('close', (code, signal) => settle({ stdout, stderr, code, signal }));
|
|
45
|
+
});
|
|
46
|
+
const printed = (text: string): Promise<void> =>
|
|
47
|
+
new Promise((settle) => {
|
|
48
|
+
if (stdout.includes(text)) settle();
|
|
49
|
+
else waits.push({ text, printed: settle });
|
|
50
|
+
});
|
|
51
|
+
return { child, finished, printed };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function withRoot(body: (root: string) => Promise<void>): Promise<void> {
|
|
55
|
+
const root = await mkdtemp(join(tmpdir(), 'all-verdicts-'));
|
|
56
|
+
try {
|
|
57
|
+
await body(root);
|
|
58
|
+
} finally {
|
|
59
|
+
await rm(root, { recursive: true, force: true });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe('all-verdicts executor', () => {
|
|
64
|
+
it('lets Biome and ESLint each reach a verdict when both find errors in one run', () =>
|
|
65
|
+
withRoot(async (root) => {
|
|
66
|
+
await writeFile(join(root, 'checked.js'), 'debugger;\n');
|
|
67
|
+
await writeFile(join(root, 'eslint.config.mjs'), "export default [{ rules: { 'no-debugger': 'error' } }];\n");
|
|
68
|
+
const biome = `${tool('biome')} check checked.js`;
|
|
69
|
+
const eslint = `${tool('eslint')} checked.js`;
|
|
70
|
+
const { stdout, stderr, code } = await startExecutor(root, [biome, eslint]).finished;
|
|
71
|
+
// Each tool's own diagnostics, not only its exit status: neither run ended the other.
|
|
72
|
+
expect(stdout, stderr).toContain('lint/suspicious/noDebugger');
|
|
73
|
+
expect(stdout, stderr).toContain("Unexpected 'debugger' statement");
|
|
74
|
+
expect(stdout, stderr).toEndWith(
|
|
75
|
+
verdictReport([
|
|
76
|
+
{ command: biome, verdict: { kind: 'fail', code: 1 } },
|
|
77
|
+
{ command: eslint, verdict: { kind: 'fail', code: 1 } },
|
|
78
|
+
]),
|
|
79
|
+
);
|
|
80
|
+
expect(code).toBe(1);
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
it('reports a command a signal ended UNJUDGED by name, beside the verdicts of the rest', () =>
|
|
84
|
+
withRoot(async (root) => {
|
|
85
|
+
const killed = 'kill -TERM $$';
|
|
86
|
+
const { stdout, stderr, code } = await startExecutor(root, [killed, 'exit 0', 'exit 2']).finished;
|
|
87
|
+
expect(stdout, stderr).toEndWith(
|
|
88
|
+
verdictReport([
|
|
89
|
+
{ command: killed, verdict: { kind: 'unjudged', cause: 'SIGTERM ended it before it gave a verdict' } },
|
|
90
|
+
{ command: 'exit 0', verdict: { kind: 'pass' } },
|
|
91
|
+
{ command: 'exit 2', verdict: { kind: 'fail', code: 2 } },
|
|
92
|
+
]),
|
|
93
|
+
);
|
|
94
|
+
expect(code).toBe(1);
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
it('reports a command that never ran UNJUDGED by name', () =>
|
|
98
|
+
withRoot(async (root) => {
|
|
99
|
+
const { stdout, stderr, code } = await startExecutor(root, ['exit 0'], 'missing').finished;
|
|
100
|
+
expect(stdout, stderr).toMatch(/\n {2}UNJUDGED +exit 0 \(it never ran: .+\)\n$/);
|
|
101
|
+
expect(code).toBe(1);
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
it('ends every command still running when the run is signalled, and reports each one UNJUDGED', () =>
|
|
105
|
+
withRoot(async (root) => {
|
|
106
|
+
const ready = join(root, 'ready.fifo');
|
|
107
|
+
const lifetime = join(root, 'lifetime.fifo');
|
|
108
|
+
expect(spawnSync('mkfifo', [ready, lifetime]).status).toBe(0);
|
|
109
|
+
// Only the shell's background sleep holds the lifetime FIFO open, so its EOF observes that the signal reached
|
|
110
|
+
// the command's whole process group, not only the shell that leads it.
|
|
111
|
+
const holding = 'sleep 3600 3>lifetime.fifo & echo up > ready.fifo; wait';
|
|
112
|
+
const closed = readFile(lifetime, 'utf8');
|
|
113
|
+
const run = startExecutor(root, ['exit 3', holding]);
|
|
114
|
+
expect(await readFile(ready, 'utf8')).toBe('up\n');
|
|
115
|
+
await run.printed('\n> exit 3\n');
|
|
116
|
+
run.child.kill('SIGTERM');
|
|
117
|
+
const { stdout, stderr, signal } = await run.finished;
|
|
118
|
+
expect(await closed).toBe('');
|
|
119
|
+
expect(signal, stderr).toBe('SIGTERM');
|
|
120
|
+
expect(stdout, stderr).toContain(`\n> ${holding}\n\n`);
|
|
121
|
+
expect(stdout, stderr).toEndWith(
|
|
122
|
+
verdictReport([
|
|
123
|
+
{ command: 'exit 3', verdict: { kind: 'fail', code: 3 } },
|
|
124
|
+
{
|
|
125
|
+
command: holding,
|
|
126
|
+
verdict: { kind: 'unjudged', cause: 'the run received SIGTERM before it gave a verdict' },
|
|
127
|
+
},
|
|
128
|
+
]),
|
|
129
|
+
);
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
it('refuses an empty command list, which could never fail', async () => {
|
|
133
|
+
expect(await allVerdictsExecutor({ commands: [], cwd: '.' }, { root: tmpdir() })).toEqual({ success: false });
|
|
134
|
+
});
|
|
135
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { type ChildProcessByStdio, spawn } from 'node:child_process';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import type { Readable } from 'node:stream';
|
|
4
|
+
|
|
5
|
+
import type { AllVerdictsOptions } from './schema.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A command's verdict. Only a command that exited reached one. A command a signal ended, one that never started and
|
|
9
|
+
* one still running when the run itself was signalled are unjudged: never a pass, and never left out of the report.
|
|
10
|
+
*/
|
|
11
|
+
export type Verdict =
|
|
12
|
+
| { readonly kind: 'pass' }
|
|
13
|
+
| { readonly kind: 'fail'; readonly code: number }
|
|
14
|
+
| { readonly kind: 'unjudged'; readonly cause: string };
|
|
15
|
+
|
|
16
|
+
export interface CommandVerdict {
|
|
17
|
+
readonly command: string;
|
|
18
|
+
readonly verdict: Verdict;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The verdict of a process that closed with exit `code`, or, when `code` is null, was ended by `signal`. */
|
|
22
|
+
export function closedVerdict(code: number | null, signal: NodeJS.Signals | null): Verdict {
|
|
23
|
+
if (code === 0) return { kind: 'pass' };
|
|
24
|
+
if (code !== null) return { kind: 'fail', code };
|
|
25
|
+
return { kind: 'unjudged', cause: `${signal ?? 'an unreported signal'} ended it before it gave a verdict` };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** How much of a command the verdict list quotes; the command's output block names it whole. */
|
|
29
|
+
const LABEL_LENGTH = 120;
|
|
30
|
+
|
|
31
|
+
function label(command: string): string {
|
|
32
|
+
return command.length <= LABEL_LENGTH ? command : `${command.slice(0, LABEL_LENGTH - 1)}…`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function tag(verdict: Verdict): string {
|
|
36
|
+
switch (verdict.kind) {
|
|
37
|
+
case 'pass':
|
|
38
|
+
return 'PASS';
|
|
39
|
+
case 'fail':
|
|
40
|
+
return `FAIL (exit ${verdict.code})`;
|
|
41
|
+
case 'unjudged':
|
|
42
|
+
return 'UNJUDGED';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Every command's verdict, in the order the target lists the commands, under a count of each verdict. */
|
|
47
|
+
export function verdictReport(verdicts: readonly CommandVerdict[]): string {
|
|
48
|
+
const count = (kind: Verdict['kind']): number => verdicts.filter(({ verdict }) => verdict.kind === kind).length;
|
|
49
|
+
const lines = verdicts.map(({ command, verdict }) => {
|
|
50
|
+
const line = ` ${tag(verdict).padEnd(15)} ${label(command)}`;
|
|
51
|
+
return verdict.kind === 'unjudged' ? `${line} (${verdict.cause})` : line;
|
|
52
|
+
});
|
|
53
|
+
const counts = `${count('pass')} passed, ${count('fail')} failed, ${count('unjudged')} unjudged`;
|
|
54
|
+
return `\nall-verdicts: ${counts} of ${verdicts.length}\n${lines.join('\n')}\n`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** On POSIX each command leads a process group of its own, so a signal reaches every process the command started. */
|
|
58
|
+
const OWN_GROUP = process.platform !== 'win32';
|
|
59
|
+
|
|
60
|
+
function signalCommand(pid: number, signal: NodeJS.Signals): void {
|
|
61
|
+
try {
|
|
62
|
+
process.kill(OWN_GROUP ? -pid : pid, signal);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
// ESRCH: every process of the command has already exited.
|
|
65
|
+
if (!(error instanceof Error && 'code' in error && error.code === 'ESRCH')) throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const TERMINATION_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] as const satisfies readonly NodeJS.Signals[];
|
|
70
|
+
|
|
71
|
+
interface Run {
|
|
72
|
+
readonly command: string;
|
|
73
|
+
readonly output: string[];
|
|
74
|
+
pid: number | undefined;
|
|
75
|
+
verdict: Verdict | null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** A command's output as one block, headed by the command the way Nx's run-commands heads it. */
|
|
79
|
+
function block(run: Run): string {
|
|
80
|
+
return `\n> ${run.command}\n\n${run.output.join('')}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Starts `run`'s command and settles with its verdict once it closes; its output prints as one block then. */
|
|
84
|
+
function judge(run: Run, cwd: string): Promise<Verdict> {
|
|
85
|
+
return new Promise((settle) => {
|
|
86
|
+
const close = (verdict: Verdict): void => {
|
|
87
|
+
// A run the signal handler already judged keeps that verdict: the run is ending by the signal.
|
|
88
|
+
if (run.verdict !== null) return;
|
|
89
|
+
run.verdict = verdict;
|
|
90
|
+
process.stdout.write(block(run));
|
|
91
|
+
settle(verdict);
|
|
92
|
+
};
|
|
93
|
+
let child: ChildProcessByStdio<null, Readable, Readable>;
|
|
94
|
+
try {
|
|
95
|
+
child = spawn(run.command, {
|
|
96
|
+
cwd,
|
|
97
|
+
shell: true,
|
|
98
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
+
detached: OWN_GROUP,
|
|
100
|
+
windowsHide: true,
|
|
101
|
+
});
|
|
102
|
+
} catch (error) {
|
|
103
|
+
close({ kind: 'unjudged', cause: `it never ran: ${error instanceof Error ? error.message : String(error)}` });
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
run.pid = child.pid;
|
|
107
|
+
for (const stream of [child.stdout, child.stderr]) {
|
|
108
|
+
stream.setEncoding('utf8');
|
|
109
|
+
stream.on('data', (text: string) => run.output.push(text));
|
|
110
|
+
}
|
|
111
|
+
child.once('error', (error) => close({ kind: 'unjudged', cause: `it never ran: ${error.message}` }));
|
|
112
|
+
child.once('close', (code, signal) => close(closedVerdict(code, signal)));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Starts every command at once and lets each reach its own verdict. Nx's run-commands cannot: in parallel it terminates
|
|
118
|
+
* the other commands once one fails, and serially it never starts the ones after a failure, so one tool's errors hide
|
|
119
|
+
* another's until a later run. Here no command ends another. Each command's output prints as one block when it closes,
|
|
120
|
+
* then every command's verdict. A signal to the run ends every command's process group, reports each command still
|
|
121
|
+
* running UNJUDGED, and ends the run by the same signal. The run succeeds only when every command passed.
|
|
122
|
+
*/
|
|
123
|
+
export default async function allVerdictsExecutor(
|
|
124
|
+
options: AllVerdictsOptions,
|
|
125
|
+
context: { readonly root: string },
|
|
126
|
+
): Promise<{ success: boolean }> {
|
|
127
|
+
if (options.commands.length === 0) {
|
|
128
|
+
process.stderr.write('all-verdicts: no commands: an empty set of checks cannot fail, so it cannot pass\n');
|
|
129
|
+
return { success: false };
|
|
130
|
+
}
|
|
131
|
+
const cwd = resolve(context.root, options.cwd);
|
|
132
|
+
const runs: Run[] = options.commands.map((command) => ({ command, output: [], pid: undefined, verdict: null }));
|
|
133
|
+
const onExit = (): void => {
|
|
134
|
+
for (const run of runs) {
|
|
135
|
+
if (run.verdict === null && run.pid !== undefined) signalCommand(run.pid, 'SIGTERM');
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const onSignal = (signal: NodeJS.Signals): void => {
|
|
139
|
+
detach();
|
|
140
|
+
const verdicts = runs.map((run): CommandVerdict => {
|
|
141
|
+
if (run.verdict === null) {
|
|
142
|
+
if (run.pid !== undefined) signalCommand(run.pid, signal);
|
|
143
|
+
run.verdict = { kind: 'unjudged', cause: `the run received ${signal} before it gave a verdict` };
|
|
144
|
+
process.stdout.write(block(run));
|
|
145
|
+
}
|
|
146
|
+
return { command: run.command, verdict: run.verdict };
|
|
147
|
+
});
|
|
148
|
+
process.stdout.write(verdictReport(verdicts), () => process.kill(process.pid, signal));
|
|
149
|
+
};
|
|
150
|
+
const listeners = TERMINATION_SIGNALS.map((signal) => [signal, () => onSignal(signal)] as const);
|
|
151
|
+
const detach = (): void => {
|
|
152
|
+
process.removeListener('exit', onExit);
|
|
153
|
+
for (const [signal, listener] of listeners) process.removeListener(signal, listener);
|
|
154
|
+
};
|
|
155
|
+
process.on('exit', onExit);
|
|
156
|
+
for (const [signal, listener] of listeners) process.on(signal, listener);
|
|
157
|
+
|
|
158
|
+
const verdicts = await Promise.all(
|
|
159
|
+
runs.map(async (run): Promise<CommandVerdict> => ({ command: run.command, verdict: await judge(run, cwd) })),
|
|
160
|
+
);
|
|
161
|
+
detach();
|
|
162
|
+
process.stdout.write(verdictReport(verdicts));
|
|
163
|
+
return { success: verdicts.every(({ verdict }) => verdict.kind === 'pass') };
|
|
164
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "All Verdicts Executor",
|
|
5
|
+
"description": "Run every command at once to its own verdict: none ends another, and each command a signal ended or that never ran is reported UNJUDGED by name.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"cli": "nx",
|
|
8
|
+
"required": ["commands", "cwd"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"commands": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": { "type": "string" },
|
|
13
|
+
"minItems": 1,
|
|
14
|
+
"description": "Shell commands, all started at once. An empty list is refused: it could never fail."
|
|
15
|
+
},
|
|
16
|
+
"cwd": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Where every command runs, relative to the workspace root."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The executor the inferred `lint` target runs its tool commands with. */
|
|
2
|
+
export const ALL_VERDICTS_EXECUTOR = '@smoothbricks/nx-plugin:all-verdicts';
|
|
3
|
+
|
|
4
|
+
/** Options of `@smoothbricks/nx-plugin:all-verdicts`. */
|
|
5
|
+
export interface AllVerdictsOptions {
|
|
6
|
+
/** Shell commands, all started at once; none ends another. An empty list is refused: it could never fail. */
|
|
7
|
+
readonly commands: readonly string[];
|
|
8
|
+
/** Where every command runs, relative to the workspace root. */
|
|
9
|
+
readonly cwd: string;
|
|
10
|
+
}
|
package/src/index.test.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './boun
|
|
|
24
24
|
import { CARGO_CLOSURE_INPUT } from './cargo-closure-input.js';
|
|
25
25
|
import { exceptionalTestFilter, packageNameFromCargoTestTarget } from './cargo-workspace.js';
|
|
26
26
|
import { CARGO_CROSS_LINT_COMMAND, CARGO_CROSS_LINT_TARGET, CARGO_LINT_CLIPPY_COMMAND } from './cross-check-policy.js';
|
|
27
|
+
import { ALL_VERDICTS_EXECUTOR } from './executors/all-verdicts/schema.js';
|
|
27
28
|
import { cargoCommandNpmPackages, createNodesV2, createNodesV2ForPlatform } from './index.js';
|
|
28
29
|
import { NEXTEST_EXTRACTION_DIRECTORY } from './nextest-extraction.js';
|
|
29
30
|
import { applyWorkspaceConfig, RELEASE_CONFIGURATION } from './workspace-config-policy.js';
|
|
@@ -188,9 +189,9 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
188
189
|
'patches/nx.patch',
|
|
189
190
|
]);
|
|
190
191
|
const before = context.hashFilesMatchingGlob(positive, negative);
|
|
191
|
-
await workspace.write('patches/README.md', name
|
|
192
|
-
await workspace.write('patches/compiler/notes.md', name
|
|
193
|
-
await workspace.write('packages/unrelated/source.ts',
|
|
192
|
+
await workspace.write('patches/README.md', `${name} docs\n`);
|
|
193
|
+
await workspace.write('patches/compiler/notes.md', `${name} nested docs\n`);
|
|
194
|
+
await workspace.write('packages/unrelated/source.ts', `export const value = ${name.length};\n`);
|
|
194
195
|
context.incrementalUpdate(
|
|
195
196
|
['patches/README.md', 'patches/compiler/notes.md', 'packages/unrelated/source.ts'],
|
|
196
197
|
[],
|
|
@@ -198,7 +199,7 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
198
199
|
expect(context.hashFilesMatchingGlob(positive, negative)).toBe(before);
|
|
199
200
|
let previous = before;
|
|
200
201
|
for (const file of ['patches/nx.patch', 'patches/compiler/PIN', 'patches/compiler/VERSION']) {
|
|
201
|
-
await workspace.write(file, name
|
|
202
|
+
await workspace.write(file, `${name} changed ${file}\n`);
|
|
202
203
|
context.incrementalUpdate([file], []);
|
|
203
204
|
const changed = context.hashFilesMatchingGlob(positive, negative);
|
|
204
205
|
expect(changed).not.toBe(previous);
|
|
@@ -1053,13 +1054,14 @@ describe('@smoothbricks/nx-plugin inferred targets', () => {
|
|
|
1053
1054
|
const biome = `biome check --files-ignore-unknown=true '${root}'`;
|
|
1054
1055
|
const rust = await inferProjectTargets(workspace, `${root}/package.json`);
|
|
1055
1056
|
const rustLint = resolveLint(rust);
|
|
1056
|
-
expect(rustLint.executor).toBe(
|
|
1057
|
+
expect(rustLint.executor).toBe(ALL_VERDICTS_EXECUTOR);
|
|
1057
1058
|
expect(rustLint.dependsOn).toEqual(['cargo-lint']);
|
|
1058
1059
|
expect(rustLint.options?.commands).toEqual([biome]);
|
|
1059
1060
|
|
|
1060
1061
|
// A JavaScript source joins ESLint's file list the moment it appears, with no tsconfig to announce it.
|
|
1061
1062
|
await workspace.write(`${root}/src/check.js`, 'debugger;\n');
|
|
1062
1063
|
const withJavaScript = resolveLint(await inferProjectTargets(workspace, `${root}/package.json`));
|
|
1064
|
+
expect(withJavaScript.executor).toBe(ALL_VERDICTS_EXECUTOR);
|
|
1063
1065
|
expect(withJavaScript.dependsOn).toEqual(['cargo-lint']);
|
|
1064
1066
|
expect(withJavaScript.options?.commands).toEqual([biome, `eslint '${root}/src/check.js'`]);
|
|
1065
1067
|
|
package/src/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
runsFrozenCargo,
|
|
67
67
|
} from './cross-check-policy.js';
|
|
68
68
|
import type { EslintFileSet } from './eslint-file-set.js';
|
|
69
|
+
import { ALL_VERDICTS_EXECUTOR } from './executors/all-verdicts/schema.js';
|
|
69
70
|
import { closeRunCpuPool, serveRunCpuPool } from './executors/bounded-exec/run-cpu-pool.js';
|
|
70
71
|
import { hashVersionlessCrateManifests } from './manifest-hash.js';
|
|
71
72
|
import {
|
|
@@ -1939,9 +1940,11 @@ async function createProjectTargets(
|
|
|
1939
1940
|
inputs: lintProgramInputs,
|
|
1940
1941
|
eslintFileSet,
|
|
1941
1942
|
} = projectLintCommands(projectRoot, workspaceRoot, eslintSources);
|
|
1943
|
+
// Every lint tool reaches its own verdict in one run: run-commands would end the
|
|
1944
|
+
// other tools once one fails, and their findings would surface a run later.
|
|
1942
1945
|
if (validationTargets.length > 0 || lintCommands.length > 0) {
|
|
1943
1946
|
targets.lint = {
|
|
1944
|
-
executor: lintCommands.length > 0 ?
|
|
1947
|
+
executor: lintCommands.length > 0 ? ALL_VERDICTS_EXECUTOR : 'nx:noop',
|
|
1945
1948
|
...(eslintFileSet === null ? {} : { metadata: { eslintFileSet } }),
|
|
1946
1949
|
cache: true,
|
|
1947
1950
|
dependsOn: validationTargets,
|
package/test-timings.json
CHANGED
|
@@ -1,106 +1,107 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"files": {
|
|
4
|
+
"src/nx-daemon-validity.test.ts": 163297,
|
|
4
5
|
"src/executors/bounded-exec/go-progress-host.test.ts": 113358,
|
|
5
|
-
"src/
|
|
6
|
-
"src/ensure-built.test.ts":
|
|
7
|
-
"src/nextest-partitions.test.ts": 65735,
|
|
8
|
-
"src/nx-daemon-validity.test.ts": 61972,
|
|
9
|
-
"src/cargo-resolve-cache.test.ts": 59317,
|
|
10
|
-
"src/task-results.test.ts": 57421,
|
|
11
|
-
"src/nx-daemon-ignore-files.test.ts": 50341,
|
|
6
|
+
"src/testing.test.ts": 80231,
|
|
7
|
+
"src/ensure-built.test.ts": 64056,
|
|
12
8
|
"src/executors/bounded-exec/cargo-progress-host.test.ts": 38973,
|
|
13
|
-
"src/cargo-
|
|
14
|
-
"src/
|
|
15
|
-
"src/
|
|
16
|
-
"src/
|
|
17
|
-
"src/
|
|
18
|
-
"src/
|
|
19
|
-
"src/
|
|
20
|
-
"src/
|
|
21
|
-
"src/
|
|
22
|
-
"src/
|
|
23
|
-
"src/
|
|
24
|
-
"src/
|
|
25
|
-
"src/
|
|
26
|
-
"src/
|
|
27
|
-
"src/
|
|
28
|
-
"src/
|
|
29
|
-
"src/nx-
|
|
30
|
-
"src/
|
|
31
|
-
"src/nx-
|
|
32
|
-
"src/
|
|
33
|
-
"src/
|
|
34
|
-
"src/nx-
|
|
35
|
-
"src/
|
|
36
|
-
"src/nx-
|
|
37
|
-
"src/
|
|
38
|
-
"src/
|
|
39
|
-
"src/
|
|
40
|
-
"src/
|
|
41
|
-
"src/
|
|
42
|
-
"src/nx-
|
|
43
|
-
"src/
|
|
44
|
-
"src/
|
|
45
|
-
"src/
|
|
46
|
-
"src/nx-
|
|
47
|
-
"src/
|
|
48
|
-
"src/
|
|
49
|
-
"src/
|
|
50
|
-
"src/
|
|
51
|
-
"src/
|
|
52
|
-
"src/
|
|
53
|
-
"src/
|
|
54
|
-
"src/nx-
|
|
55
|
-
"src/
|
|
56
|
-
"src/
|
|
57
|
-
"src/
|
|
58
|
-
"src/
|
|
59
|
-
"src/
|
|
60
|
-
"src/
|
|
61
|
-
"src/
|
|
62
|
-
"src/
|
|
63
|
-
"src/
|
|
64
|
-
"src/
|
|
65
|
-
"src/
|
|
66
|
-
"src/
|
|
67
|
-
"src/
|
|
68
|
-
"src/executors/bounded-exec/hang-diagnostics.test.ts":
|
|
69
|
-
"src/
|
|
70
|
-
"src/
|
|
71
|
-
"src/
|
|
72
|
-
"src/
|
|
73
|
-
"src/manifest-hash.test.ts":
|
|
74
|
-
"src/
|
|
75
|
-
"src/
|
|
76
|
-
"src/
|
|
77
|
-
"src/
|
|
78
|
-
"src/
|
|
79
|
-
"src/
|
|
80
|
-
"src/
|
|
81
|
-
"src/
|
|
9
|
+
"src/cargo-resolve-cache.test.ts": 32111,
|
|
10
|
+
"src/nx-use-local.test.ts": 30007,
|
|
11
|
+
"src/task-history-namespace.test.ts": 27944,
|
|
12
|
+
"src/linked-snapshots.nx.test.ts": 25811,
|
|
13
|
+
"src/nextest-partitions.test.ts": 23634,
|
|
14
|
+
"src/cargo-closure-input.test.ts": 22176,
|
|
15
|
+
"src/cargo-closure-key.test.ts": 20264,
|
|
16
|
+
"src/nx-daemon-claim.test.ts": 19031,
|
|
17
|
+
"src/task-results.test.ts": 18911,
|
|
18
|
+
"src/cargo-source-hash.test.ts": 17548,
|
|
19
|
+
"src/owned-installation.test.ts": 17429,
|
|
20
|
+
"src/nx-daemon-start-never.test.ts": 15565,
|
|
21
|
+
"src/index.test.ts": 14944,
|
|
22
|
+
"src/executors/bounded-exec/ram-temp.test.ts": 12729,
|
|
23
|
+
"src/executors/bounded-exec/executor.test.ts": 11943,
|
|
24
|
+
"src/nx-daemon-ignore-files.test.ts": 8078,
|
|
25
|
+
"src/nx-task-output-lease.test.ts": 7875,
|
|
26
|
+
"src/runtime-input.test.ts": 7250,
|
|
27
|
+
"src/nx-cache-restore-mtime.test.ts": 6617,
|
|
28
|
+
"src/nx-project-graph-errors.test.ts": 6341,
|
|
29
|
+
"src/nx-dot-input-policy.test.ts": 6218,
|
|
30
|
+
"src/nx-daemon-idle-policy.test.ts": 6206,
|
|
31
|
+
"src/bounded-test-policy.test.ts": 5397,
|
|
32
|
+
"src/nx-foreign-workspace-env.test.ts": 5162,
|
|
33
|
+
"src/nx-plugin-load-errors.test.ts": 3612,
|
|
34
|
+
"src/executors/typescript-emit/executor.test.ts": 3461,
|
|
35
|
+
"src/nx-failure-life-cycles.test.ts": 3407,
|
|
36
|
+
"src/nx-files-archive-racy.test.ts": 3142,
|
|
37
|
+
"src/serial-group-wiring.test.ts": 3025,
|
|
38
|
+
"src/nx-skipped-task-exit.test.ts": 2921,
|
|
39
|
+
"src/nx-incomplete-run-summary.test.ts": 2801,
|
|
40
|
+
"src/typescript-resolution.test.ts": 2592,
|
|
41
|
+
"src/nextest-extraction.test.ts": 2059,
|
|
42
|
+
"src/nx-resident-graph-workers.test.ts": 2039,
|
|
43
|
+
"src/typecheck-test-policy.test.ts": 1927,
|
|
44
|
+
"src/cross-check-policy.test.ts": 1857,
|
|
45
|
+
"src/ensure-built-receipt.test.ts": 1780,
|
|
46
|
+
"src/managed-files/forgejo-artifact.test.ts": 1611,
|
|
47
|
+
"src/nx-daemon-root-normalization.test.ts": 1582,
|
|
48
|
+
"src/executors/bounded-exec/verdict.test.ts": 1547,
|
|
49
|
+
"src/managed-files/managed-format-json.test.ts": 1319,
|
|
50
|
+
"src/bin/smoo-nx-bound-failures.test.ts": 1200,
|
|
51
|
+
"src/nx-raw-inputs.test.ts": 1159,
|
|
52
|
+
"src/nx-cache-bound.test.ts": 1053,
|
|
53
|
+
"src/graph-input-contract.test.ts": 1038,
|
|
54
|
+
"src/nextest-code-bound.test.ts": 926,
|
|
55
|
+
"src/ensure-built-witness.test.ts": 923,
|
|
56
|
+
"src/managed-files/generator.test.ts": 862,
|
|
57
|
+
"src/nx-store-resolution.test.ts": 844,
|
|
58
|
+
"src/bun-bootstrap.test.ts": 842,
|
|
59
|
+
"src/test-walk-policy.test.ts": 597,
|
|
60
|
+
"src/managed-files/repo-path.test.ts": 525,
|
|
61
|
+
"src/executors/all-verdicts/executor.test.ts": 461,
|
|
62
|
+
"src/executors/bounded-exec/runner-hook.test.ts": 442,
|
|
63
|
+
"src/package-target-policy.test.ts": 363,
|
|
64
|
+
"src/executors/bounded-exec/hang-diagnostics.test.ts": 322,
|
|
65
|
+
"src/test-clock-policy.test.ts": 260,
|
|
66
|
+
"src/managed-files/github-host-cache-isolation.test.ts": 258,
|
|
67
|
+
"src/version-actions.test.ts": 233,
|
|
68
|
+
"src/nx-state-location.test.ts": 214,
|
|
69
|
+
"src/manifest-hash.test.ts": 213,
|
|
70
|
+
"src/cargo-workspace.test.ts": 181,
|
|
71
|
+
"src/executors/bounded-exec/cpu-pool.test.ts": 165,
|
|
72
|
+
"src/cargo-closure-filesets.test.ts": 117,
|
|
73
|
+
"src/managed-files/setup-devenv-free-disk.test.ts": 91,
|
|
74
|
+
"src/test-timings.test.ts": 89,
|
|
75
|
+
"src/release-config-policy.test.ts": 79,
|
|
76
|
+
"src/workspace-config-policy.test.ts": 59,
|
|
77
|
+
"src/producer-receipts.test.ts": 53,
|
|
78
|
+
"src/nx-task-graph-cycles.test.ts": 49,
|
|
79
|
+
"src/executors/bounded-exec/cpu-tokens.test.ts": 40,
|
|
80
|
+
"src/managed-files/trace-db-artifact.test.ts": 38,
|
|
81
|
+
"src/generators/make-public/generator.test.ts": 35,
|
|
82
|
+
"src/generators/create-package/generator.test.ts": 30,
|
|
83
|
+
"src/generators/bun-test-tracing/generator.test.ts": 29,
|
|
84
|
+
"src/executors/bounded-exec/disk-lease.test.ts": 28,
|
|
82
85
|
"src/executors/nextest-group/executor.test.ts": 28,
|
|
83
|
-
"src/
|
|
84
|
-
"src/
|
|
85
|
-
"src/
|
|
86
|
-
"src/
|
|
87
|
-
"src/
|
|
88
|
-
"src/
|
|
89
|
-
"src/
|
|
90
|
-
"src/
|
|
91
|
-
"src/
|
|
92
|
-
"src/
|
|
93
|
-
"src/
|
|
94
|
-
"src/
|
|
95
|
-
"src/
|
|
96
|
-
"src/
|
|
97
|
-
"src/
|
|
98
|
-
"src/
|
|
99
|
-
"src/
|
|
100
|
-
"src/managed-files/
|
|
101
|
-
"src/
|
|
102
|
-
"src/
|
|
103
|
-
"src/managed-files/managed-content.test.ts": 9,
|
|
104
|
-
"src/nx-run-information.test.ts": 9
|
|
86
|
+
"src/build-state-output-policy.test.ts": 27,
|
|
87
|
+
"src/executors/bounded-exec/run-cpu-pool.test.ts": 27,
|
|
88
|
+
"src/generators/bounded-test-targets/generator.test.ts": 23,
|
|
89
|
+
"src/cargo-closure-input.property.test.ts": 21,
|
|
90
|
+
"src/test-program.test.ts": 20,
|
|
91
|
+
"src/executors/cargo-zigbuild/executor.test.ts": 19,
|
|
92
|
+
"src/nx-daemon-idle-cpu.test.ts": 18,
|
|
93
|
+
"src/host-controller-wiring.test.ts": 17,
|
|
94
|
+
"src/disk-command-policy.test.ts": 16,
|
|
95
|
+
"src/executors/clean-outputs/executor.test.ts": 16,
|
|
96
|
+
"src/managed-files/json-edit.test.ts": 16,
|
|
97
|
+
"src/managed-files/tree-permissions.test.ts": 14,
|
|
98
|
+
"src/nx-project-resolution-cache.test.ts": 14,
|
|
99
|
+
"src/executors/bounded-exec/ram-temp-held.test.ts": 13,
|
|
100
|
+
"src/managed-files/managed-content.test.ts": 13,
|
|
101
|
+
"src/nx-run-information.test.ts": 13,
|
|
102
|
+
"src/executors/bounded-exec/progress.test.ts": 12,
|
|
103
|
+
"src/managed-files/tree.test.ts": 12,
|
|
104
|
+
"src/bun-file-packages.test.ts": 11,
|
|
105
|
+
"src/executors/bounded-exec/runner-lifecycle.test.ts": 8
|
|
105
106
|
}
|
|
106
107
|
}
|