Documentation menuMigrating to 2.0
Migrating to 2.0
What breaks in Surjection 2.0, what is new, and how to upgrade from 1.x.
Surjection 2.0 changes the results format, raises the minimum Node version and adds flows, a coverage table and component checks. Most projects only need to upgrade Node and, if they use the results file in their own scripts, read one new version number.
pnpm add -D @sweberdev/surjection@^2.0.0
Breaking changes
- Node 22 or newer. Node 20 is end of life. Set
node-version: 22in your CI (the workflow written bysurjection initalready does). - Results file
version: 2.--out-jsonwrites version 2:tool,runand anidper affected element are new, nothing was removed. If your own scripts checkversion === 1, accept 2 as well. Surjection itself,--compare-withand the Pro history read both versions. Convert old files withsurjection convert old.json --out new.json, see Results format. - Baseline
version: 2.--update-baselinewrites entries with id, page, rule, target and an optionalnote. A baseline of version 1 is still read, so nothing breaks if you do not touch it. Runsurjection convert surjection-baseline.json --out surjection-baseline.jsononce to switch and commit the result. fingerprints(page)returns ids. The exported function now returns the 12 character ids instead of"<path>|<rule>|<target>"strings. Only code that reads these strings itself is affected.createBaselineandapplyBaselinetake a version 2 baseline; usenormalizeBaseline(json)to read any version.ResultsFiletype.versionis2,toolis required. Code that builds a results file by hand should usecreateResults(pages).
Nothing else was removed. Surjection 1.x had no deprecated exports.
New in 2.0
- Flows: check a journey, with a check after each step.
- Coverage:
surjection coverageshows which of the 55 WCAG 2.2 A/AA criteria are tested automatically. - Component checks:
@sweberdev/surjection/componentfor Storybook and Testing Library. - Results format: stable ids per finding, run settings and tool version.
- Config:
flowsis new, everything else stays as it was (statesis not deprecated). The JSON schema knowsflows.
Surjection Pro
Pro 2.0 adds the WCAG-EM conformance report, the ACR export and the re-test flow, see the Pro pages. Pro 1.0.1 and newer read results of version 2; if you run an older Pro version, update it before you update Surjection, or convert the file.
Version 1.x
Version 1.x gets security and bug fixes for 12 months after 2.0.0. See Stability.