test: stabilize dependency verification
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -110,7 +110,7 @@ describe("dist bundle Bun globals", () => {
|
||||
stdout: "node-esm-load-ok",
|
||||
stderr: "",
|
||||
})
|
||||
})
|
||||
}, 20_000)
|
||||
|
||||
test.skipIf(!existsSync(DIST_INDEX))("#given dist bundle #when scanned for raw Bun runtime APIs #then no unshimmed Bun API calls remain", async () => {
|
||||
expect(hasRawBunApiCall("Bun.file('dist/index.js')")).toBe(true)
|
||||
@@ -172,5 +172,5 @@ describe("dist bundle Bun globals", () => {
|
||||
expect(stdout).toContain("SMOKE_OK:")
|
||||
expect(stderrLower).not.toContain("referenceerror")
|
||||
expect(stderr).not.toContain("Bun is not defined")
|
||||
})
|
||||
}, 20_000)
|
||||
})
|
||||
|
||||
@@ -4,6 +4,7 @@ import path from "node:path"
|
||||
import ts from "typescript"
|
||||
|
||||
const SOURCE_ROOT = path.resolve(import.meta.dir, "..")
|
||||
const MOCK_MODULE_TOKEN = "mock.module"
|
||||
const MOCK_MODULE_LIFECYCLE_ALLOWLIST = new Map<string, string>([
|
||||
// TODO(MOCK-MODULE-AUDIT): add cleanup for ast-grep tool module mocks.
|
||||
[
|
||||
@@ -191,6 +192,10 @@ describe("mock.module lifecycle hygiene", () => {
|
||||
}
|
||||
|
||||
const contents = await readFile(filePath, "utf8")
|
||||
if (!contents.includes(MOCK_MODULE_TOKEN)) {
|
||||
continue
|
||||
}
|
||||
|
||||
const sourceFile = ts.createSourceFile(filePath, contents, ts.ScriptTarget.Latest, true)
|
||||
if (hasMockModuleCall(sourceFile) && !hasCleanupPattern(sourceFile)) {
|
||||
offenders.push(relativeSourcePath(filePath))
|
||||
@@ -199,5 +204,5 @@ describe("mock.module lifecycle hygiene", () => {
|
||||
|
||||
// then
|
||||
expect(offenders.sort()).toEqual([])
|
||||
})
|
||||
}, 20_000)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user