mirror of
https://github.com/zhu1090093659/dsh-web.git
synced 2026-09-28 06:13:45 +08:00
The skin, pet and community packages left this repository, so packages/skins/ never exists in a checkout of it. Every scanner that still walked it as a second root did so defensively — family-packages.mjs and coverage-gate.discoverPackages listed it first and guarded the walk with existsSync, aggregate.mjs looked for a second aggregate manifest and a second package index under it, e2e-mount-rewrite searched it for workspace packages, and seven test files built fixtures under it. The walkers now name packages/ as the single root and the fixtures and comments follow; modules that only carried the root in a doc comment are reworded. scripts/coverage-baseline.json loses the three packages no longer measured here; its sixteen keys now name exactly the sixteen package directories on disk. The in-repo fallback paths in scripts/market-build stay untouched: they are the documented route for building from a checkout that still carries the packages, and the fixture-based market-build tests populate them deliberately.
66 lines
2.3 KiB
JavaScript
66 lines
2.3 KiB
JavaScript
/**
|
|
* Unit tests for the committed-lib fingerprint guard: which files reach a
|
|
* bundle, that the fingerprint is order-independent and content-sensitive, and
|
|
* that the aggregate manifest's package lists are read completely.
|
|
*/
|
|
import { describe, it } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { fingerprintEntries, isBundledSource, parseAggregateInputs } from './lib-artifact-check.mjs'
|
|
|
|
describe('isBundledSource', () => {
|
|
it('keeps shipped sources', () => {
|
|
assert.equal(isBundledSource('client/index.ts'), true)
|
|
assert.equal(isBundledSource('client/runtime/shell-rendering.ts'), true)
|
|
assert.equal(isBundledSource('reviewed-hooks.generated.ts'), true)
|
|
})
|
|
|
|
it('drops tests wherever they sit', () => {
|
|
assert.equal(isBundledSource('client/gameplay-hud.test.tsx'), false)
|
|
assert.equal(isBundledSource('client/work-tick-gate.test.ts'), false)
|
|
assert.equal(isBundledSource('tests/routes.spec.ts'), false)
|
|
assert.equal(isBundledSource('client/tests/helper.ts'), false)
|
|
assert.equal(isBundledSource('gameplay.spec.ts'), false)
|
|
})
|
|
})
|
|
|
|
describe('fingerprintEntries', () => {
|
|
it('is independent of input order', () => {
|
|
const a = fingerprintEntries([['b.ts', '2'], ['a.ts', '1']])
|
|
const b = fingerprintEntries([['a.ts', '1'], ['b.ts', '2']])
|
|
assert.equal(a, b)
|
|
})
|
|
|
|
it('tracks content and membership', () => {
|
|
const base = fingerprintEntries([['a.ts', '1']])
|
|
assert.notEqual(base, fingerprintEntries([['a.ts', '2']]))
|
|
assert.notEqual(base, fingerprintEntries([['a.ts', '1'], ['b.ts', '1']]))
|
|
assert.notEqual(base, fingerprintEntries([['b.ts', '1']]))
|
|
})
|
|
})
|
|
|
|
describe('parseAggregateInputs', () => {
|
|
it('reads every ../ entry from the list sections', () => {
|
|
const yaml = [
|
|
'patchFrom:',
|
|
' - ../dsh-market',
|
|
' - ../dsh-usage',
|
|
'self:',
|
|
' - ../dsh-web-all',
|
|
'deps:',
|
|
' - ../dsh-preset-center',
|
|
'inactive:',
|
|
' - web-ui-pet',
|
|
].join('\n')
|
|
assert.deepEqual(parseAggregateInputs(yaml), [
|
|
'packages/dsh-market',
|
|
'packages/dsh-usage',
|
|
'packages/dsh-web-all',
|
|
'packages/dsh-preset-center',
|
|
].sort())
|
|
})
|
|
|
|
it('ignores lines that are not list entries', () => {
|
|
assert.deepEqual(parseAggregateInputs('# comment\ndeps:\n'), [])
|
|
})
|
|
})
|