test: vendor the NoNetwork fixtures from publiccode-parser-go

Open
#702 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go, typescript
Domain
testing, tooling

Research direction

Start with src/wasm/go.mod, specs/add-e2e/spec.md sections 2.7, 5.1, and 5.2, and the existing fixture guard pattern in src/app/contents/publiccode.spec.ts. Then implement the fixture fetch script, Jest guard, and contributor bump procedure described in the issue; verify the acceptance criteria, including byte-for-byte reproduction at v5.4.3 and detection of a version mismatch.

Written by the indexing model from the issue text.

Description

Context

Sub-task T9 of #655. See specs/add-e2e/spec.md §5.1 and §5.2, and §2.7 (parser version drift: fixtures must be pinned to the parser version compiled into the WASM, currently v5.4.3 in src/wasm/go.mod).

Scope

Fixtures (e2e/fixtures/)

Committed at v5.4.3, keeping the source tree layout under testdata/v0/, including the assets/ folders:

Path Files Go test
valid/no-network/ valid.yml, valid_with_supports.yml TestValidTestcasesV0_NoNetwork
invalid/no-network/ landingURL_invalid, localisation_localisationReady_yaml11_{yes,no,on,off}, logo_invalid_png, logo_missing_file, monochromeLogo_invalid_png, supports_unknown_alias TestInvalidTestcasesV0_NoNetwork
valid_with_warnings/no-network/ authorsFile.yml TestValidWithWarningTestcasesV0_NoNetwork
invalid/ (optional) description_en_screenshots_missing_file.yml, logo_missing_url.yml TestRelativePathsOrURLsNoNetworkRemoteChecks

Plus SOURCE.json (repo, ref, resolved commit SHA, fetchedAt), LICENSE.EUPL-1.2 and NOTICE.md (origin and attribution).

Excluded: TestRelativePathsOrURLsNoNetwork, because it checks paths on the local filesystem, which the browser does not have.

scripts/fetchFixtures.ts + npm run e2e:fixtures
  • Arguments: --repo (default italia/publiccode-parser-go), --ref (default: the version read from src/wasm/go.mod).
  • Shallow, sparse, blob-filtered clone into a temp dir → sparse-checkout of the paths above → replace e2e/fixtures/testdata/v0/ → copy LICENSE → write NOTICE.md and SOURCE.json.
  • No authentication, touches nothing outside e2e/fixtures/. CI never downloads fixtures.
Guard

scripts/fixtures-source.spec.ts (Jest) fails if SOURCE.json.ref differs from the publiccode-parser-go version in src/wasm/go.mod, following the pattern of src/app/contents/publiccode.spec.ts.

Docs

Bump procedure in CONTRIBUTING.md:

  1. npm run e2e:fixtures -- --ref vX.Y.Z;
  2. review e2e/expectations.json against the new _NoNetwork tables;
  3. commit together with the parser bump.

Open decisions

  • Include the optional TestRelativePathsOrURLsNoNetworkRemoteChecks pair? Recommended: yes, it is the only parser test that reproduces the WASM's exact condition.
  • Licence: redistributing EUPL-1.2 test data, with attribution, inside this AGPL-3.0 repository. Maintainers to confirm.

Side effect

Dependabot / parser bump PRs fail the guard until the fixtures are refreshed. This is intended.

Acceptance criteria

  • npm run e2e:fixtures reproduces the committed tree byte for byte at v5.4.3
  • SOURCE.json, LICENSE.EUPL-1.2 and NOTICE.md are present
  • The Jest guard passes now and fails when go.mod and SOURCE.json diverge
  • The bump procedure is documented in CONTRIBUTING.md

Related

  • Parent: #655
  • No technical blocker; can proceed in parallel with T1–T8
  • Blocks: T10 (conformance), T11 (differential filling)
Dominant language
TypeScript
Stars
33
Forks
34
Avg merge
10h 50m
Merged PRs (30d)
13

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from italia/publiccode-editor

All issues in italia/publiccode-editor

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.