diff --git a/tests/bundles/auto-tests.zzb b/tests/bundles/auto-tests.zzb index 4097a60..ff2b84f 100644 --- a/tests/bundles/auto-tests.zzb +++ b/tests/bundles/auto-tests.zzb @@ -36,6 +36,22 @@ requests: $.args.foo1: bar1 $.args.foo2: bar2 + get-with-params-skip: + method: GET + url: /get + params: + foo1: bar1 + foo2: bar2 + tests: # old way of specifying json tests + status: { $eq: 0, $skip: true } + $h.Content-type: { $eq: random-test, $skip: true } + json: + $.args: + $skip: false + $tests: + $.foo1 : bar2 + $.foo2: bar1 + get-with-params-no-value-positive: method: GET url: /get @@ -53,7 +69,7 @@ requests: - { name: foo2, value: multi-1 } - { name: foo2, value: multi-2 } tests: - $.args.foo1: { $eq: bar1, $skip: true } + $.args.foo1: bar1 $.args.foo2: { $eq: ["multi-1", "multi-2"] } get-with-params-values-as-array-positive: @@ -251,9 +267,7 @@ requests: $.data.lastName: { $exists: true } # $.data.middleName: { $exists: true, $type: "null" } $.data.middleName: null - $.data.otherName: - $tests: - $.: { $exists: true, $type: undefined, $skip: true } + $.data.otherName: { $exists: false, $type: undefined } # stress: ensure corner cases don't crash $.data.otherName.value: { $exists: false } # don't recurse down undefined $.data.middleName.value: { $exists: false } # don't recurse down null diff --git a/tests/runTests.ts b/tests/runTests.ts index 82188c2..1b858fd 100644 --- a/tests/runTests.ts +++ b/tests/runTests.ts @@ -71,24 +71,21 @@ function allNegative(res: SpecResult, numTests: number): string[] { function allSkipped(res: SpecResult, numTests: number): string[] { const errors: string[] = []; - const [_passed, skipped, all] = getResultData(res); if (all !== numTests) errors.push(`expected ${numTests} tests, got ${all}\n`); if (skipped === all) return errors; - function getSkippedTests(res: SpecResult, spec: string): string[] { - const skippedTests: string[] = []; - if (!res.skipped) return skippedTests; - - const rootSkipped = res.results; - skippedTests.push(...rootSkipped.map((r) => formatTestResult(r, spec, true))); + function getRanTests(res: SpecResult, spec: string): string[] { + const nonSkippedTests: string[] = []; + if (res.skipped) return nonSkippedTests; - for (const s of res.subResults) skippedTests.push(...getSkippedTests(s, spec + " > " + s.spec)); + nonSkippedTests.push(...res.results.map((r) => formatTestResult(r, spec, res.skipped))); + for (const s of res.subResults) nonSkippedTests.push(...getRanTests(s, spec + " > " + s.spec)); - return skippedTests; + return nonSkippedTests; } - errors.push(...getSkippedTests(res, res.spec ?? "")); + errors.push(...getRanTests(res, res.spec ?? "")); return errors; }