@zgeoff/chex 0.3.9 → 0.3.11
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
CHANGED
|
@@ -58,7 +58,7 @@ The repo checks read the branch, the pushed commits and the repo's config:
|
|
|
58
58
|
| `local-paths` | a line a pushed commit adds that holds the home folder or the host name | `--pushed-refs` |
|
|
59
59
|
| `test-timeouts` | a `bun test` timeout above its lane's limit, in a script or a `bunfig.toml` | none |
|
|
60
60
|
| `test-layout` | a test folder, file name or import outside [the test layout](../../docs/guides/test-layout.md) | none |
|
|
61
|
-
| `workflows` | nothing: it
|
|
61
|
+
| `workflows` | nothing: it prints each fault of the shared workflow lint, and fails when there is one | the paths |
|
|
62
62
|
| `dependency-gates` | a stale age-gate exclude, an override or an audit ignore that nothing needs, a first-party package with no age-gate exclude, or a pinned release younger than the age gate ([details](../../docs/architecture/dependency-updates.md#the-dependency-gates-check)) | none |
|
|
63
63
|
| `uncommitted` | a file the branch changes that holds a change the push does not send | none |
|
|
64
64
|
|
package/package.json
CHANGED
|
@@ -341,8 +341,7 @@ function collectWorkflowRunFindings(context: WorkflowContext): WorkflowFinding[]
|
|
|
341
341
|
];
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
// Returns the exit code: 0 when clean
|
|
345
|
-
// check cannot run.
|
|
344
|
+
// Returns the exit code: 0 when clean, 1 when any fault exists, and 2 when the check cannot run.
|
|
346
345
|
export function runWorkflowsCommand(args: readonly string[]): number {
|
|
347
346
|
const paths = parseCLIPaths(args);
|
|
348
347
|
|
|
@@ -376,8 +375,10 @@ export function runWorkflowsCommand(args: readonly string[]): number {
|
|
|
376
375
|
|
|
377
376
|
if (findings.length > 0) {
|
|
378
377
|
process.stdout.write(
|
|
379
|
-
`workflows: ${findings.length} ${findings.length === 1 ? '
|
|
378
|
+
`workflows: ${findings.length} ${findings.length === 1 ? 'fault' : 'faults'}\n`,
|
|
380
379
|
);
|
|
380
|
+
|
|
381
|
+
return 1;
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
return 0;
|
|
@@ -402,7 +403,7 @@ function parseCLIPaths(args: readonly string[]): string[] | Error {
|
|
|
402
403
|
function formatAnnotation(finding: WorkflowFinding): string {
|
|
403
404
|
const file = escapeAnnotationData(finding.path).replaceAll(':', '%3A').replaceAll(',', '%2C');
|
|
404
405
|
|
|
405
|
-
return `::
|
|
406
|
+
return `::error file=${file},line=${finding.line}::${escapeAnnotationData(finding.message)}`;
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
function escapeAnnotationData(text: string): string {
|
|
@@ -74,14 +74,25 @@ function collectFolderPaths(trackedPaths: readonly string[]): string[] {
|
|
|
74
74
|
const testFolderNames = new Set(['test', 'tests', '__tests__']);
|
|
75
75
|
|
|
76
76
|
function collectTestFolderFaults(trackedPaths: readonly string[]): string[] {
|
|
77
|
+
const tracked = new Set(trackedPaths);
|
|
78
|
+
|
|
77
79
|
return collectFolderPaths(trackedPaths)
|
|
78
80
|
.filter((folder) => testFolderNames.has(posix.basename(folder)))
|
|
81
|
+
.filter((folder) => !isCargoTestsFolder(folder, tracked))
|
|
79
82
|
.map(
|
|
80
83
|
(folder) =>
|
|
81
84
|
`${folder}/ is a test folder; move its tests beside the modules they test, its end-to-end tests into the package's e2e/, and its helpers into src/test-utils/`,
|
|
82
85
|
);
|
|
83
86
|
}
|
|
84
87
|
|
|
88
|
+
// Cargo runs a crate's integration tests only from the tests/ folder beside its Cargo.toml.
|
|
89
|
+
function isCargoTestsFolder(folder: string, tracked: ReadonlySet<string>): boolean {
|
|
90
|
+
return (
|
|
91
|
+
posix.basename(folder) === 'tests' &&
|
|
92
|
+
tracked.has(posix.join(posix.dirname(folder), 'Cargo.toml'))
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
function collectHelperFolderFaults(layout: TestLayout): string[] {
|
|
86
97
|
return layout.workspaces
|
|
87
98
|
.filter((root) => layout.trackedPaths.some((path) => path.startsWith(`${root}/test-utils/`)))
|