@avi2dg/checks 0.45.1 → 0.47.0
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/CHANGELOG.md +16 -0
- package/README.md +3 -1
- package/dist/presets/stylelint.js +8 -0
- package/docs/design.md +6 -2
- package/docs/gates/checks-advisories.md +3 -2
- package/docs/gates/checks-css-size.md +53 -0
- package/docs/gates/checks-flake.md +3 -2
- package/docs/gates/checks-frontend-syntax.md +5 -0
- package/docs/gates/checks-lint.md +2 -1
- package/docs/gates/checks-mutation-baseline.md +3 -3
- package/docs/gates/checks-mutation-compare.md +10 -8
- package/docs/gates/checks-mutation-scope.md +10 -10
- package/docs/gates/checks-mutation.md +4 -4
- package/docs/gates/checks-night-run.md +188 -0
- package/docs/gates/checks-release-notes.md +2 -1
- package/docs/gates/checks-release-pr.md +7 -1
- package/docs/gates/checks-test.md +5 -2
- package/package.json +6 -1
- package/src/core/gates.ts +3 -0
- package/src/core/main.ts +14 -0
- package/src/delivery/github.ts +7 -8
- package/src/quality/css-size.ts +69 -0
- package/src/quality/no-plain-js.ts +3 -10
- package/src/quality/presets/stylelint.ts +12 -0
- package/src/testing/mutation-compare.ts +1 -1
- package/src/testing/mutation-scope.ts +1 -1
- package/src/testing/night-run-findings.ts +74 -0
- package/src/testing/night-run.ts +253 -0
- package/src/testing/test.ts +24 -6
package/src/testing/test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { Config, Console, Effect, FileSystem, Path, Schema } from "effect";
|
|
2
|
+
import { Config, Console, Effect, FileSystem, Option, Path, Schema } from "effect";
|
|
3
3
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
4
|
import { TEST_ENTRY_POINT } from "../core/gates.ts";
|
|
5
5
|
import { runMain, Usage } from "../core/main.ts";
|
|
@@ -26,7 +26,7 @@ export type TestOptions = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const NAME = TEST_ENTRY_POINT.bin;
|
|
29
|
-
const USAGE = `usage: ${NAME} [--tier=live | --tier=pixel | --tier=unit | --tier=e2e] [--parallel=<workers>], and it refuses test filters`;
|
|
29
|
+
const USAGE = `usage: ${NAME} [--tier=live | --tier=pixel | --tier=unit | --tier=e2e] [--parallel=<workers>] [--junit=<file>], and it refuses test filters`;
|
|
30
30
|
const TIERS = new Map<string, TestTier>([
|
|
31
31
|
["--tier=live", "live"],
|
|
32
32
|
["--tier=pixel", "pixel"],
|
|
@@ -34,6 +34,7 @@ const TIERS = new Map<string, TestTier>([
|
|
|
34
34
|
["--tier=e2e", "e2e"],
|
|
35
35
|
]);
|
|
36
36
|
const PARALLEL = /^--parallel=([1-9][0-9]*)$/;
|
|
37
|
+
const JUNIT = /^--junit=(.+)$/;
|
|
37
38
|
|
|
38
39
|
function optionOf(arg: string): TestOptions | undefined {
|
|
39
40
|
const tier = TIERS.get(arg);
|
|
@@ -52,6 +53,16 @@ export function testOptions(args: readonly string[]): TestOptions | undefined {
|
|
|
52
53
|
return options;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
export type EntryOptions = { readonly options: TestOptions; readonly junit: Option.Option<string> };
|
|
57
|
+
|
|
58
|
+
// Kept out of testOptions, so checks-test-layout still holds a package.json test script to --parallel alone.
|
|
59
|
+
export function entryOptions(args: readonly string[]): EntryOptions | undefined {
|
|
60
|
+
const junit = args.flatMap((arg) => JUNIT.exec(arg)?.[1] ?? []);
|
|
61
|
+
const options = testOptions(args.filter((arg) => !JUNIT.test(arg)));
|
|
62
|
+
if (options === undefined || junit.length > 1) return undefined;
|
|
63
|
+
return { options, junit: Option.fromNullishOr(junit[0]) };
|
|
64
|
+
}
|
|
65
|
+
|
|
55
66
|
const TEST_SCRIPTS: readonly string[] = [NAME, `bun src/${TEST_ENTRY_POINT.script}`];
|
|
56
67
|
|
|
57
68
|
export function scriptOptions(script: unknown): TestOptions | undefined {
|
|
@@ -169,15 +180,22 @@ const runSuite = Effect.fn("runSuite")(function* (outfile: string, { tier, worke
|
|
|
169
180
|
});
|
|
170
181
|
|
|
171
182
|
const testEntry = Effect.gen(function* () {
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
183
|
+
const entry = entryOptions(process.argv.slice(2));
|
|
184
|
+
if (entry === undefined) return yield* new Usage({ message: USAGE });
|
|
185
|
+
const { options, junit } = entry;
|
|
174
186
|
const fs = yield* FileSystem.FileSystem;
|
|
187
|
+
const path = yield* Path.Path;
|
|
175
188
|
const declarations = yield* readSkipDeclarations(process.cwd(), options.tier);
|
|
176
189
|
const environment = yield* environmentOf;
|
|
177
190
|
|
|
178
|
-
const outfile =
|
|
191
|
+
const outfile = path.join(yield* fs.makeTempDirectoryScoped({ prefix: "checks-test-" }), "junit.xml");
|
|
179
192
|
const suitePassed = (yield* runSuite(outfile, options)) === ChildProcessSpawner.ExitCode(0);
|
|
180
|
-
|
|
193
|
+
const written = yield* fs.exists(outfile);
|
|
194
|
+
if (written && Option.isSome(junit)) {
|
|
195
|
+
yield* fs.makeDirectory(path.dirname(junit.value), { recursive: true });
|
|
196
|
+
yield* fs.copyFile(outfile, junit.value);
|
|
197
|
+
}
|
|
198
|
+
if (!written) {
|
|
181
199
|
if (!suitePassed) {
|
|
182
200
|
yield* Console.error(`${NAME}: bun test failed before it wrote a report, so no skip was judged`);
|
|
183
201
|
return false;
|