mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
test(BASE-05): capture published distribution and type consumers
This commit is contained in:
1 parent
2b7054d8a5
commit
c7a375e146
21 files changed
+5079
-28
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import test from 'node:test'
|
||||
import { consumerProfile, runConsumers, validateConsumerReport } from './consumers.mjs'
|
||||
import { validateDistribution } from './distribution.mjs'
|
||||
import { refactorDir } from './releases.mjs'
|
||||
import { validateSsr } from './ssr.mjs'
|
||||
|
||||
test('Published packages rerun isolated runtime and strict TypeScript consumers', async () => {
|
||||
const frozen = JSON.parse(fs.readFileSync(path.join(refactorDir, 'baselines/consumers.json'), 'utf8'))
|
||||
validateConsumerReport(frozen)
|
||||
const result = await runConsumers()
|
||||
validateConsumerReport(result)
|
||||
assert.deepEqual(consumerProfile(result), consumerProfile(frozen))
|
||||
for (const mutate of [
|
||||
value => value.runtime.checks.pop(),
|
||||
value => value.compilerOptions.skipLibCheck = true,
|
||||
value => value.types.find(item => item.mode === 'bundler-esm' && item.fixture === 'public.ts').diagnostics.push({ code: 2322 }),
|
||||
value => value.releases[0].version = 'wrong',
|
||||
]) {
|
||||
const changed = structuredClone(frozen)
|
||||
mutate(changed)
|
||||
assert.throws(() => validateConsumerReport(changed))
|
||||
}
|
||||
})
|
||||
|
||||
test('Distribution inventory preserves all packages and the thumbnail discrepancy', () => {
|
||||
const frozen = JSON.parse(fs.readFileSync(path.join(refactorDir, 'baselines/distribution.json'), 'utf8'))
|
||||
validateDistribution(frozen)
|
||||
const changed = structuredClone(frozen)
|
||||
changed.packages.pop()
|
||||
assert.throws(() => validateDistribution(changed))
|
||||
})
|
||||
|
||||
test('Browser SSR evidence requires node identity, real metadata and cleanup', () => {
|
||||
const frozen = JSON.parse(fs.readFileSync(path.join(refactorDir, 'baselines/ssr.json'), 'utf8'))
|
||||
validateSsr(frozen.report)
|
||||
const changed = structuredClone(frozen.report)
|
||||
changed.observations.videoWidth = 0
|
||||
assert.throws(() => validateSsr(changed))
|
||||
})
|
||||
Reference in new issue
Block a user