Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/vitest-native/scripts/fidelity-report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,25 @@
? JSON.parse(fs.readFileSync(knownDiffsPath, "utf8"))
: [];

// The page is built by VitePress, which parses Markdown as Vue: a bare `<Tag>`
// in free text is read as an (unclosed) HTML element and breaks the build, `|`
// breaks table columns, and `{{ }}` is Vue interpolation. Probe names/reasons
// and known-difference text come from the corpus, so escape those hazards in
// any cell rendered as free text (not inside a code span).
const cell = (s) =>
String(s ?? "")
.replace(/\|/g, "\\|")

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.
Comment on lines +107 to +108
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/\{\{/g, "&#123;&#123;")
.replace(/\}\}/g, "&#125;&#125;");

const probeRows = probes
.map((p) => `| \`${p.name}\` | ${p.match ? "✅ match" : `❌ ${p.reason ?? "diverged"}`} |`)
.map((p) => `| \`${p.name}\` | ${p.match ? "✅ match" : `❌ ${cell(p.reason ?? "diverged")}`} |`)
.join("\n");

const knownDiffRows = knownDiffs.length
? knownDiffs.map((d) => `| ${d.area} | ${d.difference} | ${d.why} |`).join("\n")
? knownDiffs.map((d) => `| ${cell(d.area)} | ${cell(d.difference)} | ${cell(d.why)} |`).join("\n")
: "| _none recorded_ | | |";

const page = `<!--
Expand Down
2 changes: 1 addition & 1 deletion website/guide/fidelity.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ They are documented here rather than hidden.
| Area | Behavior | Why it isn't gated |
| --- | --- | --- |
| Default device metrics (Dimensions / PixelRatio) | The default window/screen size, pixel ratio and font scale are a fixed test-host default. Both engines report the same default — the cross-check gates that — but it is not any specific physical device. | Device metrics aren't behavior, and the default won't match a real device. Tests that depend on exact metrics should set them explicitly (e.g. Dimensions.set) rather than rely on the default. |
| Text onPress accessibilityRole | A <Text> with an onPress handler is auto-assigned accessibilityRole "link" by some React Native versions and not others. | Version-variant across the supported RN range — a single mock value can't match every minor, so it isn't pinned by a probe. |
| Text onPress accessibilityRole | A &lt;Text&gt; with an onPress handler is auto-assigned accessibilityRole "link" by some React Native versions and not others. | Version-variant across the supported RN range — a single mock value can't match every minor, so it isn't pinned by a probe. |
| Appearance color scheme | Appearance.getColorScheme() reflects the host environment rather than a fixed value. | Environment-dependent (CI vs local, OS settings), so it isn't a stable cross-engine invariant to gate. |
Loading