Skip to content

Commit

Permalink
test: Obey yaml-test-suite skip instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Jun 8, 2024
1 parent 4e66d72 commit f3c7d03
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/yaml-test-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ type TestCase = {
dump?: string
}

type TestFile = [TestCase & { name: string }, ...TestCase[]]
type TestFile = [TestCase & { name: string; skip?: boolean }, ...TestCase[]]

const skip: Record<string, boolean | string[]> = {
'2JQS/0': ['test.event', 'errors'], //
'2JQS/0': ['test.event', 'errors'], // duplicate empty keys are invalid
'9MMA/0': ['errors'], // allow stream with directive & no docs
'SF5V/0': ['errors'], // allow duplicate %YAML directives

// FIXME recent upstream additions
'ZYU8/2': ['errors']
'SF5V/0': ['errors'] // allow duplicate %YAML directives
}

function testJsonMatch(docs: Document[], json: string) {
Expand Down Expand Up @@ -58,6 +55,7 @@ for (const fn of readdirSync(testRoot)) {
const file = readFileSync(path, 'utf8')
const testData = parse(file) as TestFile
if (!Array.isArray(testData)) throw new Error(`Unsupported test file: ${fn}`)
if (testData[0].skip) continue

const name = `${id}: ${testData[0].name}`
for (let i = 0; i < testData.length; ++i) {
Expand Down

0 comments on commit f3c7d03

Please sign in to comment.