test: remove fixture inventories and diagnostic-only cases

This commit is contained in:
OrcaWin
2026-11-08 19:27:35 -08:00
parent c8ffe4fd3d
commit 477291a09b
4 changed files with 1 additions and 191 deletions
@@ -1,4 +1,4 @@
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'node:path'
import process from 'node:process'
@@ -36,29 +36,4 @@ describe('validate-plugin-files', () => {
expect(result.code).toBe(1)
expect(result.stderr).toContain('panel/index.html')
}, 60_000)
it('passes a scaffolded plugin, explaining why there is no release entry outside Git', async () => {
const dir = path.join(await tempRoot(), 'dusk')
await createPluginFromTemplate({ dir, template: 'theme', publisher: 'acme' })
const result = await validate(dir)
expect(result.code, result.stderr).toBe(0)
expect(result.stdout).toContain('not in a Git repository')
}, 60_000)
it('passes a language pack that translates protected copy, warning that Orca ignores it', async () => {
const dir = path.join(await tempRoot(), 'portuguese')
await createPluginFromTemplate({ dir, template: 'language-pack', publisher: 'acme' })
await writeFile(
path.join(dir, 'locales', 'pt-BR.json'),
JSON.stringify({
common: { cancel: 'Cancelar' },
components: { 'native-chat': { approval: { allow: 'Permitir', deny: 'Negar' } } }
})
)
const result = await validate(dir)
expect(result.code, result.stderr).toBe(0)
expect(result.stderr).toContain(
'warning: contributes.languagePacks "pt-BR" (locales/pt-BR.json): 2 protected strings are ignored'
)
}, 60_000)
})
@@ -1,66 +0,0 @@
import { mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterAll, describe, expect, it } from 'vitest'
import { copyScriptWithLocalModules } from './script-module-dependencies.mjs'
const fixtureDir = mkdtempSync(join(tmpdir(), 'script-module-dependencies-'))
afterAll(() => {
rmSync(fixtureDir, { recursive: true, force: true })
})
function sourceTree(files) {
const sourceDir = mkdtempSync(join(fixtureDir, 'source-'))
for (const [name, contents] of Object.entries(files)) {
writeFileSync(join(sourceDir, name), contents)
}
return sourceDir
}
function copiedNames(files, entryName) {
const sourceDir = sourceTree(files)
const destinationDir = join(mkdtempSync(join(fixtureDir, 'dest-')), 'scripts')
copyScriptWithLocalModules(join(sourceDir, entryName), destinationDir)
const names = readdirSync(destinationDir).sort()
for (const name of names) {
expect(readFileSync(join(destinationDir, name), 'utf8'), name).toBe(files[name])
}
return names
}
describe('copyScriptWithLocalModules', () => {
it('preserves parent paths for modules shared with the runtime', () => {
const sourceDir = sourceTree({ 'runtime.ts': 'export const value = 42\n' })
mkdirSync(join(sourceDir, 'scripts'))
writeFileSync(join(sourceDir, 'scripts', 'entry.mjs'), "export { value } from '../runtime'\n")
const destinationRoot = mkdtempSync(join(fixtureDir, 'dest-'))
copyScriptWithLocalModules(
join(sourceDir, 'scripts', 'entry.mjs'),
join(destinationRoot, 'scripts')
)
expect(readFileSync(join(destinationRoot, 'runtime.ts'), 'utf8')).toBe(
'export const value = 42\n'
)
})
// Cover require-only CJS gate dependencies so copied fixture fails for target defect, not missing module.
it('follows a require reached only through an imported module', () => {
const names = copiedNames(
{
'entry.mjs': "import './middle.cjs'\n",
'middle.cjs': "require('./leaf.cjs')\n",
'leaf.cjs': 'module.exports = {}\n'
},
'entry.mjs'
)
expect(names).toContain('leaf.cjs')
})
it('terminates on a cycle rather than recursing forever', () => {
expect(
copiedNames({ 'a.mjs': "import './b.mjs'\n", 'b.mjs': "import './a.mjs'\n" }, 'a.mjs')
).toEqual(['a.mjs', 'b.mjs'])
})
})
@@ -157,7 +157,6 @@ export const WINDOWS_BOUNDARY_TESTS = [
'config/scripts/native-build/windows/windows-pe-machine.test.mjs',
'config/scripts/native-build/windows/build-windows-cli-launcher.test.mjs',
'config/scripts/desktop-distribution/runtime-verification/verify-packaged-windows-agent-hook.test.mjs',
'config/scripts/test-fixtures/script-copy-closure/script-module-dependencies.test.mjs',
'src/main/windows/windows-registry-addon.test.ts',
'src/main/daemon/executable-host/windows/testing/daemon-host-process-package.test.ts',
'src/shared/windows-security-addon.win32.test.ts',
@@ -1,98 +0,0 @@
import { beforeAll, describe, expect, it } from 'vitest'
import {
buildUnitDependencyGraph,
collectUnitDependencyGraph,
unitConsumers
} from '../../ci/unit-selection/dependency-graph/ci-unit-dependency-graph.mjs'
import {
CROSS_VERSION_WIRE_DIR,
discoverUnitFiles
} from '../../ci/unit-selection/dependency-graph/ci-unit-files.mjs'
const harness =
'src/renderer/src/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture.ts'
const structuredSessionHarness =
'src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.test-harness.tsx'
const unitHarnesses = [
harness,
structuredSessionHarness,
'src/renderer/src/store/slices/editor/editor-slice-test-harness.ts',
'src/renderer/src/store/slices/browser/browser-slice-test-harness.ts',
'src/renderer/src/runtime/hosted-terminals/creation/testing/web-runtime-terminal-create.test-fixture.ts',
'src/renderer/src/runtime/sync-runtime-graph/testing/sync-runtime-graph-test-harness.ts'
]
const supportBridges = new Set([
// Launch request suites' store rig; it takes the terminal harness's workspace layout.
'src/renderer/src/runtime/hosted-terminals/creation/agent-launch/web-runtime-agent-launch-options.test-fixture.ts',
'src/renderer/src/runtime/browser/creation/testing/web-runtime-browser-creation-placement-test-rig.ts',
'src/renderer/src/components/editor/model-lifetime/retention/editor-model-lifetime-fixture.ts',
// Autosave suites' store rig; it takes the editor harness's tab-layout maps.
'src/renderer/src/components/editor/autosave/editor-autosave-controller-test-fixture.ts',
// Closed-saving-view save suites' rig; it builds on the autosave rig above.
'src/renderer/src/components/editor/save/queue/editor-save-closed-view.test-fixture.ts',
// Browser suites' store with main drawing their tabs; it takes the browser harness's store.
'src/renderer/src/store/slices/browser/browser-slice-drawn-from-main.test-fixture.ts'
])
function productConsumers(file, graph, unitFiles) {
return [...unitConsumers([file], graph.reverse)].filter(
(consumer) =>
consumer !== file &&
!unitFiles.has(consumer) &&
!(consumer.startsWith(CROSS_VERSION_WIRE_DIR) && consumer.endsWith('.unit.test.ts')) &&
!supportBridges.has(consumer)
)
}
describe('unit support import ownership', () => {
let graph
let unitFiles
beforeAll(() => {
graph = collectUnitDependencyGraph()
unitFiles = new Set(discoverUnitFiles())
}, 60_000)
it.each(unitHarnesses)('rejects any product consumer of %s', (unitHarness) => {
expect(graph.files.has(unitHarness)).toBe(true)
expect(
[...unitConsumers([unitHarness], graph.reverse)].some((file) => unitFiles.has(file))
).toBe(true)
expect(productConsumers(unitHarness, graph, unitFiles)).toEqual([])
})
it.each([
"import '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'",
"export * from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'",
"import('@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture')",
"import type { Fixture } from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'"
])('detects a product importer using %s', (source) => {
const importer = 'src/renderer/src/runtime/product.ts'
const test = 'src/renderer/src/runtime/ownership.test.ts'
const synthetic = buildUnitDependencyGraph(
new Map([
[harness, 'export const value = 1'],
[importer, source],
[test, "import './web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'"]
])
)
expect(productConsumers(harness, synthetic, new Set([test]))).toEqual([importer])
})
it('rejects product consumers reached through an audited support bridge', () => {
const bridge =
'src/renderer/src/components/editor/model-lifetime/retention/editor-model-lifetime-fixture.ts'
const importer = 'src/renderer/src/components/editor/product.ts'
const synthetic = buildUnitDependencyGraph(
new Map([
[harness, 'export const value = 1'],
[
bridge,
"import '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'"
],
[importer, "import './model-lifetime/retention/editor-model-lifetime-fixture'"]
])
)
expect(productConsumers(harness, synthetic, new Set())).toEqual([importer])
})
})