Skip to content

feat: split test:pw into per-suite scripts (path-analyser, request-validation)#25

Merged
jwulf merged 4 commits into
mainfrom
feat/split-test-pw-scripts
Apr 26, 2026
Merged

feat: split test:pw into per-suite scripts (path-analyser, request-validation)#25
jwulf merged 4 commits into
mainfrom
feat/split-test-pw-scripts

Conversation

@jwulf

@jwulf jwulf commented Apr 26, 2026

Copy link
Copy Markdown
Member

Answer to the original question

Before: npm run test:pw ran only the path-analyser positive suite. The request-validation negative suite had no root-level runner.

After:

Script What it runs
npm run test:pw:path-analyser Positive scenarios only
npm run test:pw:request-validation Negative request-validation only
npm run test:pw Both, sequential

Implementation

  • test:pw:request-validation reuses the materialized request-validation/generated/playwright.config.ts (its testDir: '.' + testMatch: '**/*.spec.ts' already match what we want), driven from root deps \u2014 no nested npm install required.
  • testsuite:observe:run now invokes test:pw:path-analyser explicitly because the runtime-observation pipeline only instruments the positive suite.
  • README quick start and the available-scripts table updated.

Verification

  • npx vitest run \u2014 49/49 pass
  • npm run test:pw:path-analyser \u2014 488 passed locally
  • npm run test:pw:request-validation \u2014 58 ran (2 expected auth-related failures against my local cluster)

jwulf added 2 commits April 27, 2026 09:03
Generated Playwright suites use ESM constructs (e.g. `import.meta.url` in
`support/seeding.ts`) but their materialized package.json did not declare
`"type": "module"`. Running `npm run test:pw` from the workspace root
(where the parent `path-analyser/package.json` is itself ESM) caused
Playwright/Node to load the transpiled output ambiguously and surface:

  ReferenceError: exports is not defined in ES module scope
    at support/seeding.ts:3

Add `"type": "module"` to both template package.json files so the
materialized suites unambiguously declare their module format and match the
ESM source they ship.

Affected templates:
- path-analyser/templates/package.json
- request-validation/templates/package.json

Snapshot regenerated; all 49 vitest tests pass; verified end-to-end with
`npx playwright test ...` in the materialized suite.
The regression baseline previously pinned `specRef: "main"`, which
caused the upstream-spec hash check (`tests/regression/spec-pin.setup.ts`)
to fail every time camunda/camunda's `main` advanced — even though the
snapshot itself was unchanged. Reviewers saw an opaque drift signal that
required a no-op snapshot bump on each rebase.

Pin `specRef` to commit
`2b2b962a312b86586ade7547d513783371db32a2` (the SHA the current snapshot
was captured against; `expectedSpecHash` is unchanged, confirming the
pin is content-equivalent to the previous baseline).

This requires `camunda-schema-bundler@^2.1.0`, which adds raw-SHA
support to `fetchSpec` (camunda/camunda-schema-bundler#22). Bump the
dep accordingly and document the SHA-pin convention in spec-pin.json's
`$comment`.
@jwulf jwulf force-pushed the feat/split-test-pw-scripts branch from 1ab3098 to ad4ca60 Compare April 26, 2026 21:29
@jwulf jwulf self-assigned this Apr 26, 2026
jwulf added 2 commits April 27, 2026 09:31
…anifest

CI for PR #24 failed with:

    Pipeline output drifted from snapshot.
      Missing (1):
      - path-analyser/dist/generated-tests/test-results/.last-run.json

The snapshot was captured locally after a Playwright run, which writes
`test-results/.last-run.json` into the generated-tests tree. CI never
runs Playwright before the snapshot test, so the file is absent and the
regression test fails.

Same class of defect would also affect `node_modules/` (left over from
local `npm install` inside a generated suite) and `playwright-report/`.

Filter all three out of `buildManifest()` so the manifest reflects only
generator output, not runtime artifacts. Both the snapshot writer and
the regression test reuse this function, so the filter applies on both
sides.

Regenerated manifest: 413 -> 412 files (the dropped entry is the
playwright last-run marker).
…lidation)

Previously `npm run test:pw` only ran the path-analyser positive suite;
the request-validation negative suite had no root-level runner and was
only reachable by cd-ing into `request-validation/generated/` and
installing deps locally (which then triggered the "Requiring
@playwright/test second time" duplicate-load error).

New scripts:

  - `test:pw:path-analyser`      — positive scenarios only
  - `test:pw:request-validation` — negative request-validation only
  - `test:pw`                    — sequential composite of the two

`test:pw:request-validation` re-uses the materialized
`request-validation/generated/playwright.config.ts` (testDir `.`,
testMatch `**/*.spec.ts`), driven from root deps so no nested
`npm install` is required.

`testsuite:observe:run` now invokes `test:pw:path-analyser` explicitly
because the runtime-observation pipeline only instruments the positive
suite.

README quick start and the available-scripts table updated to document
the three options. Snapshot regenerated.
@jwulf jwulf force-pushed the feat/split-test-pw-scripts branch from ad4ca60 to b85ee65 Compare April 26, 2026 21:31
@jwulf jwulf merged commit 4e88455 into main Apr 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant