|
|
@@ -32,19 +32,29 @@ test('every built bundle imports under Node', (context) => {
|
|
|
}, 900_000)
|
|
|
|
|
|
// The hook replaces only the chosen bundle; shared build artifacts stay intact.
|
|
|
+// The admitted evidence is Node's unknown-`.css`-extension refusal whatever
|
|
|
+// stylesheet it names; another extension, error code, or message is a finding.
|
|
|
test.each([
|
|
|
['expected-css', 0, 'baselineExempt=1 unexpectedBaselineFailure=0'],
|
|
|
+ ['other-css', 0, 'baselineExempt=1 unexpectedBaselineFailure=0'],
|
|
|
+ ['other-extension', 1, '- UNEXPECTED BASELINE FAILURE'],
|
|
|
['error', 1, '- UNEXPECTED BASELINE FAILURE'],
|
|
|
- ['other-css', 1, '- UNEXPECTED BASELINE FAILURE'],
|
|
|
['other-code', 1, '- UNEXPECTED BASELINE FAILURE'],
|
|
|
['clean', 1, '- STALE EXEMPTION'],
|
|
|
] as const)('classifies dockkit import: %s', (mode, status, finding) => {
|
|
|
const root = new URL('../../../../../', import.meta.url)
|
|
|
const bundle = 'packages/client/ui-dockkit/lib/index.js'
|
|
|
- const css = fileURLToPath(new URL('packages/client/ui-dockkit/lib/components/dockkit.module.css', root))
|
|
|
+ const cssBase = fileURLToPath(new URL('packages/client/ui-dockkit/lib/components/dockkit.module', root))
|
|
|
+ const extension = mode === 'other-extension' ? '.wasm' : '.css'
|
|
|
+ // The other stylesheet is the dependency's, which the launcher resolves into
|
|
|
+ // its source tree: the sweep reports it where an exact-path admission would
|
|
|
+ // reject the bundle.
|
|
|
+ const file = mode === 'other-css'
|
|
|
+ ? fileURLToPath(new URL('packages/client/ui-primitives/src/StateDot.module.css', root))
|
|
|
+ : `${cssBase}${extension}`
|
|
|
const message = mode === 'error'
|
|
|
? 'dockkit-negative-control'
|
|
|
- : `Unknown file extension ".css" for ${mode === 'other-css' ? `${css}.other.css` : css}`
|
|
|
+ : `Unknown file extension "${extension}" for ${file}`
|
|
|
const source = mode === 'clean'
|
|
|
? 'export {}'
|
|
|
: `throw Object.assign(new Error(${JSON.stringify(message)}), { code: ${JSON.stringify(mode === 'other-code' ? 'ERR_OTHER' : 'ERR_UNKNOWN_FILE_EXTENSION')} })`
|
|
|
@@ -74,7 +84,7 @@ test.each([
|
|
|
expect(finished.signal).toBeNull()
|
|
|
expect(finished.status, output).toBe(status)
|
|
|
expect(output).toContain(finding)
|
|
|
- if (mode === 'error' || mode === 'other-css' || mode === 'other-code') {
|
|
|
+ if (finding.startsWith('- UNEXPECTED BASELINE FAILURE')) {
|
|
|
expect(output).toContain(`- UNEXPECTED BASELINE FAILURE ${bundle}: ${message}\n`)
|
|
|
}
|
|
|
})
|