fix(test): report a failing test whose stack names a Bun builtin frame (#35384)

This commit is contained in:
Neil
2026-10-28 15:15:29 -07:00
committed by GitHub
parent bfbdcd7e80
commit f12e12f212
4 changed files with 39 additions and 7 deletions
@@ -0,0 +1,17 @@
import { readdirSync, readFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import { dirname, join } from 'node:path'
import { expect, it } from 'vitest'
// Bun names builtins `native:L:C`; Vitest resolved that against the repo root, read the `native/`
// directory as a source map and crashed the run (EISDIR), hiding the real failure. The patch
// reads source maps only from files; an upgrade that drops it fails here.
it('reads stack-frame source maps only from files', () => {
const vitestRoot = dirname(createRequire(import.meta.url).resolve('vitest/package.json'))
const chunks = join(vitestRoot, 'dist', 'chunks')
const cliApi = readdirSync(chunks).find((name) => /^cli-api\..+\.js$/.test(name))
expect(cliApi).toBeDefined()
expect(readFileSync(join(chunks, String(cliApi)), 'utf8')).toContain(
'existsSync(file) && statSync(file).isFile()'
)
})