Commit 49290088 by 张立顺

test: harden miniprogram npm boundaries

1 parent e1dbe420
......@@ -35,12 +35,22 @@ describe('mini-program npm dependency pruning', () => {
const packageJson = JSON.parse(
await readFile(path.join(projectRoot, 'package.json'), 'utf8')
)
const packageLock = JSON.parse(
await readFile(path.join(projectRoot, 'package-lock.json'), 'utf8')
)
const yarnLock = await readFile(path.join(projectRoot, 'yarn.lock'), 'utf8')
const appConfig = JSON.parse(
await readFile(path.join(projectRoot, 'app.json'), 'utf8')
)
assert.equal(packageJson.dependencies['glsk-applet-component'], '^1.0.0')
assert.equal(
packageLock.packages[''].dependencies['glsk-applet-component'],
'^1.0.0'
)
assert.ok(packageLock.packages['node_modules/glsk-applet-component'])
assert.match(yarnLock, /^glsk-applet-component@\^1\.0\.0:\r?$/m)
assert.equal(
appConfig.usingComponents['glsx-privacy'],
'glsk-applet-component/GlsxPrivacy/index'
)
......
......@@ -43,8 +43,8 @@ describe('小程序上传边界', () => {
const config = JSON.parse(
await readFile(path.join(projectRoot, 'project.config.json'), 'utf8')
)
const ignored = new Set(
(config.packOptions?.ignore || []).map(item => item.value)
const ignoredTypes = new Map(
(config.packOptions?.ignore || []).map(item => [item.value, item.type])
)
assert.equal(config.setting?.ignoreUploadUnusedFiles, true)
......@@ -62,12 +62,17 @@ describe('小程序上传边界', () => {
'outputs',
'typings',
'.superpowers',
'test',
'test'
]) {
assert.equal(ignoredTypes.get(entry), 'folder', `未以目录忽略上传内容:${entry}`)
}
for (const entry of [
'project.private.config.json',
'yarn.lock',
'prettier-plugin-wxml.mjs'
]) {
assert.ok(ignored.has(entry), `未忽略上传非运行时内容:${entry}`)
assert.equal(ignoredTypes.get(entry), 'file', `未以文件忽略上传内容:${entry}`)
}
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!