优化
This commit is contained in:
@@ -111,6 +111,22 @@ test('GitLab runs the topology contract in a dedicated Node job', async () => {
|
||||
assert.match(packageJob, /^ - Java拓扑合同$/m)
|
||||
})
|
||||
|
||||
test('GitLab validates every static OpenAPI document before packaging', async () => {
|
||||
const gitlab = await read('.gitlab-ci.yml')
|
||||
const openapiJob = gitlab.match(/^OpenAPI有效性:\n([\s\S]*?)(?=^[^\s#].*:\n)/m)?.[1] ?? ''
|
||||
const packageJob = gitlab.match(/^打包服务:\n([\s\S]*)/m)?.[1] ?? ''
|
||||
|
||||
assert.match(openapiJob, /^ stage: verify$/m)
|
||||
assert.match(openapiJob, /^ image: node:[^\s]+$/m)
|
||||
assert.match(openapiJob, /^ - npm ci --ignore-scripts --prefix scripts\/openapi-validation$/m)
|
||||
assert.match(openapiJob, /^ - npm test --prefix scripts\/openapi-validation$/m)
|
||||
assert.match(openapiJob, /^ - npm run validate --prefix scripts\/openapi-validation$/m)
|
||||
assert.doesNotMatch(openapiJob, /\bnpx\b|@latest/)
|
||||
assert.match(packageJob, /^ - Java拓扑合同$/m)
|
||||
assert.match(packageJob, /^ - OpenAPI有效性$/m)
|
||||
assert.match(packageJob, /^ - 校验与测试$/m)
|
||||
})
|
||||
|
||||
test('Jenkins cannot invoke the Node contract without declaring a Node runtime', async () => {
|
||||
for (const path of ['Jenkinsfile', 'Jenkinsfile.service']) {
|
||||
const pipeline = await read(path)
|
||||
|
||||
Reference in New Issue
Block a user