test(workflow): assert bun test summary guard intent
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -3,29 +3,25 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
import { describe, expect, test } from "bun:test"
|
||||||
import { readFileSync } from "node:fs"
|
import { readFileSync } from "node:fs"
|
||||||
|
|
||||||
const workflowChecks = [
|
|
||||||
{
|
|
||||||
path: new URL("../.github/workflows/ci.yml", import.meta.url),
|
|
||||||
testRuns: [
|
|
||||||
"run: bun test",
|
|
||||||
"run: bun test src/shared/dist-bundle-bun-globals.test.ts",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: new URL("../.github/workflows/publish.yml", import.meta.url),
|
|
||||||
testRuns: ["run: bun test"],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
describe("test workflows", () => {
|
describe("test workflows", () => {
|
||||||
test("use pure bun test for workflows", () => {
|
test("#given CI workflow #when tests run #then plain bun test is guarded by completion summary", () => {
|
||||||
for (const workflowCheck of workflowChecks) {
|
// given
|
||||||
// #given
|
const workflow = readFileSync(new URL("../.github/workflows/ci.yml", import.meta.url), "utf8")
|
||||||
const workflow = readFileSync(workflowCheck.path, "utf8")
|
|
||||||
|
|
||||||
for (const testRun of workflowCheck.testRuns) {
|
// then
|
||||||
expect(workflow).toContain(testRun)
|
expect(workflow).toMatch(/bun test/)
|
||||||
}
|
expect(workflow).not.toContain("run-ci-tests")
|
||||||
}
|
expect(workflow).toContain("assert-test-summary")
|
||||||
|
expect(workflow).toContain("bun test src/shared/dist-bundle-bun-globals.test.ts")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("#given publish workflow #when tests run #then plain bun test is guarded by completion summary", () => {
|
||||||
|
// given
|
||||||
|
const workflow = readFileSync(new URL("../.github/workflows/publish.yml", import.meta.url), "utf8")
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(workflow).toMatch(/bun test/)
|
||||||
|
expect(workflow).not.toContain("run-ci-tests")
|
||||||
|
expect(workflow).toContain("assert-test-summary")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user