@maniumek/suwgate 0.5.0 → 0.5.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/README.md +13 -4
- package/dist/profiles/dotnet.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,10 @@ pnpm exec suwgate step # the steps of this repository, with their ti
|
|
|
12
12
|
pnpm exec suwgate step e2e -- --headed -g notes # one step and what it needs; after --, arguments for its tool
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
pnpm installs a version only once it is a day old (`minimumReleaseAge`). To take a new suwgate the day it is published, exclude
|
|
16
|
+
the package by name in `pnpm-workspace.yaml`, `minimumReleaseAgeExclude: ["@maniumek/suwgate"]`: an entry with a version
|
|
17
|
+
(`@maniumek/suwgate@0.5.0`) has to be edited on every version bump, the name does not.
|
|
18
|
+
|
|
15
19
|
`suwgate.yml` in the repository root says what the repository is and where it departs from the defaults:
|
|
16
20
|
|
|
17
21
|
```yaml
|
|
@@ -117,7 +121,9 @@ build come with it) and prints the report `suwgate check` prints, with the same
|
|
|
117
121
|
server): `suwgate step e2e` does not run them.
|
|
118
122
|
- It is not a gate pass: the Stop hook does not count it, and the next turn still runs the quick gate.
|
|
119
123
|
- The evidence still applies where it makes sense for one step: a test step that ran 0 tests fails (a filter that matches
|
|
120
|
-
nothing is a mistake)
|
|
124
|
+
nothing is a mistake). With arguments, `dotnet-test` counts the tests of the whole run, not of each test project
|
|
125
|
+
(`--ignore-exit-code 8` for each test project, then xUnit's reports of all of them), so `--filter-class "*Notes*"` passes in a
|
|
126
|
+
repository with more than one test project and fails only when no test anywhere matched; `dotnet-test` asks the .NET guards' evidence only when it gets no arguments, because a filtered run
|
|
121
127
|
leaves guards out on purpose; `criteria-ran` reads the reports of the same run, so `suwgate step criteria-ran` runs every
|
|
122
128
|
test step first, and with `--only` it has no reports and fails.
|
|
123
129
|
|
|
@@ -274,8 +280,8 @@ A check counts only when the tool shows it ran, not because a file or a line of
|
|
|
274
280
|
`VerifyAll` or `Guards.Verify`) writes its id and outcome there. The step fails unless every guard of the profiles that
|
|
275
281
|
`guards.skip` does not name is in it, so a deleted guard test, a `[Fact(Skip = …)]` or a filtered-out one fails the gate.
|
|
276
282
|
- Zero tests fail: `unit-tests`, `stories` (Vitest, its JSON report), `e2e` (Playwright, its JSON report) and `dotnet-test`
|
|
277
|
-
(`--zero-tests-policy strict` of Microsoft.Testing.Platform, and xUnit's XML
|
|
278
|
-
every test was skipped. A repository with truly no tests for a profile skips the step in `suwgate.yml` with a reason.
|
|
283
|
+
(`--zero-tests-policy strict` of Microsoft.Testing.Platform for each test project, and xUnit's XML reports for the whole run)
|
|
284
|
+
fail when the tool ran no test, also when every test was skipped. A repository with truly no tests for a profile skips the step in `suwgate.yml` with a reason.
|
|
279
285
|
- `typecheck` reads `tsc --showConfig` of every tsconfig it checks: the strict options of the suwgate preset must be in effect, so
|
|
280
286
|
an override that turns one off fails, naming the option.
|
|
281
287
|
- `lint` reads `eslint --print-config` of a source file of `src/`: `suwgate/no-comments` and `boundaries/dependencies` must be
|
|
@@ -290,7 +296,10 @@ A check counts only when the tool shows it ran, not because a file or a line of
|
|
|
290
296
|
stylesheet that module imports. Both read the sources: the evidence (a run hitting `/health`, a built stylesheet with the
|
|
291
297
|
kit's tokens) needs a running server or a production build, which the gate does not have in every repository.
|
|
292
298
|
- The reports live in a temporary folder of the run (`SUWGATE_RUN`), deleted when `suwgate check` ends. `dotnet-test` asks xUnit
|
|
293
|
-
for its XML report (`--report-xunit-xml`), so every .NET test project tests with xUnit v3.
|
|
299
|
+
for its XML report (`--report-xunit-xml`), so every .NET test project tests with xUnit v3. Each test project writes its own
|
|
300
|
+
report, `<project>.<target framework>.xunit.xml` (`--report-xunit-xml-filename` through `TestingPlatformCommandLineArguments`,
|
|
301
|
+
from a targets file the step passes as `-p:CustomAfterMicrosoftCommonTargets`): xUnit's own name is the moment the project
|
|
302
|
+
started, which two projects that start together share, and one report would overwrite the other.
|
|
294
303
|
|
|
295
304
|
`suwgate dev db|logs|smoke|server|tmux|checkout-env` runs the local stack of the template (database, logs, smoke test, server, tmux
|
|
296
305
|
session, worktree databases) from a `dev` section of `suwgate.yml`: [docs/dev.md](docs/dev.md).
|
package/dist/profiles/dotnet.js
CHANGED
|
@@ -6,7 +6,10 @@ const GUARD_PACKAGE = /<(PackageReference|ProjectReference)\b[^>]*(?:Include|Upd
|
|
|
6
6
|
const TEST_PROJECT = /<PackageReference\b[^>]*Include="xunit\.v3"|<IsTestProject>true<\/IsTestProject>/;
|
|
7
7
|
export const NO_IDLE_BUILD_PROCESSES = "export MSBUILDDISABLENODEREUSE=1 DOTNET_CLI_USE_MSBUILD_SERVER=0";
|
|
8
8
|
const BUILD = `${NO_IDLE_BUILD_PROCESSES} && dotnet build --nologo -v quiet`;
|
|
9
|
-
const
|
|
9
|
+
const REPORT_NAMES = "$run/report-names.targets";
|
|
10
|
+
const REPORT_NAMES_TARGETS = "<Project><PropertyGroup><TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --report-xunit-xml-filename "$(MSBuildProjectName).$(TargetFramework).xunit.xml"</TestingPlatformCommandLineArguments></PropertyGroup></Project>";
|
|
11
|
+
const TEST_OPTIONS = `-p:CustomAfterMicrosoftCommonTargets="${REPORT_NAMES}" --no-build --no-progress --zero-tests-policy strict --report-xunit-xml --results-directory "$run/results"`;
|
|
12
|
+
const ONLY_AN_EMPTY_RUN_FAILS = "${1:+--ignore-exit-code 8}";
|
|
10
13
|
const FORMAT = `${NO_IDLE_BUILD_PROCESSES} && dotnet tool restore >/dev/null`;
|
|
11
14
|
export const DOTNET_BUILD = "dotnet-build";
|
|
12
15
|
export const DOTNET_TEST = "dotnet-test";
|
|
@@ -54,6 +57,7 @@ export function witnessed(context, tests) {
|
|
|
54
57
|
return [
|
|
55
58
|
runDirectory(DOTNET_TEST),
|
|
56
59
|
'export SUWGATE_EVIDENCE="$run/evidence"',
|
|
60
|
+
`printf '%s' ${quoted(REPORT_NAMES_TARGETS)} >"${REPORT_NAMES}"`,
|
|
57
61
|
tests,
|
|
58
62
|
verdictCommand(`tests xunit "$run/results" ${quoted("dotnet test")}`),
|
|
59
63
|
`{ [ $# -gt 0 ] || ${verdictCommand(`guards "$run/evidence" ${requiredGuards(context).map(quoted).join(" ")}`)}; }`,
|
|
@@ -87,7 +91,7 @@ export const dotnetSteps = [
|
|
|
87
91
|
profile: "dotnet",
|
|
88
92
|
needs: ["dotnet"],
|
|
89
93
|
after: [DOTNET_BUILD, DATABASE_UP],
|
|
90
|
-
run: (context) => inCheckoutEnv(context, witnessed(context, `dotnet test ${testOptions(context)} "$@"`)),
|
|
94
|
+
run: (context) => inCheckoutEnv(context, witnessed(context, `dotnet test ${testOptions(context)} ${ONLY_AN_EMPTY_RUN_FAILS} "$@"`)),
|
|
91
95
|
quick: (context) => {
|
|
92
96
|
const command = guardTests(context);
|
|
93
97
|
return command === null ? null : inCheckoutEnv(context, witnessed(context, command));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maniumek/suwgate",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "One quality gate for every repository: suwgate check runs the steps of the repository's profiles and its guards, configured in suwgate.yml",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Manomenu",
|