mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-15 09:06:16 -08:00
build(site): [SITE-07] verify Node path origin and preserve complete notices
This commit is contained in:
1 parent
d2b2f76db8
commit
d3aa4bbfe4
24 files changed
+4050
-5
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import fs from 'node:fs'
|
||||
import { expect, test } from './fixtures.js'
|
||||
|
||||
const cases = JSON.parse(fs.readFileSync('refactor/baselines/monaco-node-path-fixtures.json', 'utf8'))
|
||||
|
||||
test('docs Monaco path port preserves frozen Node path results in both namespaces', async ({ page }, testInfo) => {
|
||||
await page.goto('/test/player.html?core=candidate&chapter=published')
|
||||
await page.addScriptTag({ url: '/assets/js/vs/loader.js' })
|
||||
const result = await page.evaluate(async (cases) => {
|
||||
window.require.config({ paths: { vs: '/assets/js/vs' } })
|
||||
const load = ids => new Promise((resolve, reject) => window.require(ids, (...modules) => resolve(modules), reject))
|
||||
await load(['vs/editor/editor.main'])
|
||||
const [paths, process] = await load(['vs/base/common/path', 'vs/base/common/process'])
|
||||
const values = cases.map(entry => paths[entry.namespace][entry.method](...entry.args))
|
||||
const namespace = process.platform === 'win32' ? 'win32' : 'posix'
|
||||
const sample = namespace === 'win32' ? 'C:\\a\\..\\b' : '/a/../b'
|
||||
let invalid
|
||||
try {
|
||||
paths.normalize(42)
|
||||
}
|
||||
catch (error) {
|
||||
invalid = { name: error.name, code: error.code }
|
||||
}
|
||||
return { values, namespace, alias: paths.normalize(sample) === paths[namespace].normalize(sample), invalid }
|
||||
}, cases)
|
||||
expect(result.values).toEqual(cases.map(entry => entry.expected))
|
||||
expect(result.alias).toBe(true)
|
||||
// This is the retained VS Code Error subclass, not Node's TypeError wrapper.
|
||||
expect(result.invalid).toEqual({ name: 'Error', code: 'ERR_INVALID_ARG_TYPE' })
|
||||
await testInfo.attach('monaco-path-results', { contentType: 'application/json', body: JSON.stringify({ cases: cases.length, ...result }) })
|
||||
})
|
||||
@@ -25,6 +25,7 @@ test('mobile vConsole shows logs and upstream site notice texts are served uncha
|
||||
{ path: '/licenses/console/react-pure-render/ATTRIBUTION.md', count: 2 },
|
||||
{ path: '/licenses/monaco-editor/language-services/ATTRIBUTION.md', count: 12 },
|
||||
{ path: '/licenses/monaco-editor/core-origins/ATTRIBUTION.md', count: 3 },
|
||||
{ path: '/licenses/monaco-editor/core-path/ATTRIBUTION.md', count: 1 },
|
||||
]) {
|
||||
const attribution = await request.get(path)
|
||||
expect(attribution.status()).toBe(200)
|
||||
|
||||
Reference in new issue
Block a user