Skip to content

Commit 720665d

Browse files
Better describe the snapshot testing
1 parent 5e9a192 commit 720665d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ inject/chrome.js @jonathanKingston @sammacbeth
1414
inject/windows.js @jonathanKingston @q71114 @szanto90balazs
1515

1616
# Test owners
17-
integration-tests/test-pages/ @kdzwinel @jonathanKingston
17+
integration-tests/test-pages/ @kdzwinel @jonathanKingston
18+
unit-tests/script-overload-snapshots/ @shakyShane @jonathanKingston @englehardt

scripts/generateOverloadSnapshots.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { wrapScriptCodeOverload } from '../src/features/runtime-checks/script-ov
33
import { join } from 'node:path'
44
import { readFileSync, writeFileSync, readdirSync } from 'node:fs'
55
import { cwd } from './script-utils.js'
6-
7-
// path helpers
86
const ROOT = join(cwd(import.meta.url))
97
const configPath = join(ROOT, '../unit-test/script-overload-snapshots/config')
108

9+
/**
10+
* Generates a bunch of snapshots for script-overload.js results using the configs.
11+
* These are used in unit-test/script-overload.js and ran automatically in automation so that we verify the output is correct.
12+
*/
1113
function generateOut () {
1214
const files = readdirSync(configPath)
1315
for (const fileName of files) {

unit-test/script-overload.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { wrapScriptCodeOverload } from '../src/features/runtime-checks/script-ov
33
import { join } from 'node:path'
44
import { readFileSync, readdirSync } from 'node:fs'
55
import { cwd } from '../scripts/script-utils.js'
6-
7-
// path helpers
86
const ROOT = join(cwd(import.meta.url))
97
const configPath = join(ROOT, '/script-overload-snapshots/config')
108

119
describe('Output validation', () => {
1210
it('Given the correct config we should generate expected code output', () => {
11+
// Uses the snapshots generated in scripts/generateOverloadSnapshots.js to ensure we don't break the output.
1312
const files = readdirSync(configPath)
1413
for (const fileName of files) {
1514
const config = readFileSync(join(configPath, fileName)).toString()

0 commit comments

Comments
 (0)