bpmax-cli 0.1.44-beta.18 → 0.1.44-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js
CHANGED
|
@@ -449,7 +449,7 @@ function normalizePath2(path11) {
|
|
|
449
449
|
// package.json
|
|
450
450
|
var package_default = {
|
|
451
451
|
name: "bpmax-cli",
|
|
452
|
-
version: "0.1.44-beta.
|
|
452
|
+
version: "0.1.44-beta.19",
|
|
453
453
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
454
454
|
type: "module",
|
|
455
455
|
bin: {
|
|
@@ -11261,6 +11261,10 @@ var URL_RE = /https?:\/\/|\/w:[^\s,,;;]+|\/project\?|\/project_detail\/|\/pr
|
|
|
11261
11261
|
var SHA_RE = /^[0-9a-f]{40}$/;
|
|
11262
11262
|
var CONFIG_BASIS_REASON_RE = /(依据|覆盖|校验|验证|对应|因为|reason=|why=|=>|->)/;
|
|
11263
11263
|
var PREP_TOKEN_RE = /(账号|入口|样本|准备操作|预期|主数据|权限|自动化|依赖流程|清理策略|绑定解析|定位规则|模拟用户)=/g;
|
|
11264
|
+
var TEST_DATA_TOKEN_RE = /(业务场景|业务逻辑|样本数据|合理性|客户口径|数据约束)=/g;
|
|
11265
|
+
var GENERIC_SAMPLE_VALUE_RE = /(^|[=,;,\s])(sample|test|mock|demo|xxx|todo|tbd|placeholder|随便|假数据|占位|待补)(?=$|[,;,\s])/i;
|
|
11266
|
+
var SENSITIVE_TEST_DATA_RE = /authorization|bearer\s+[A-Za-z0-9._-]+|cookie|set-cookie|api[-_]?key|token|password|passwd|pwd|secret|session|验证码|手机号|\b1[3-9]\d{9}\b/i;
|
|
11267
|
+
var RAW_PAYLOAD_TEST_DATA_RE = /(^|[;;]\s*)(payload|完整payload|request|请求体|headers?)\s*=/i;
|
|
11264
11268
|
var PLACEHOLDER_RE = /<[^>]+>/;
|
|
11265
11269
|
var IMAGE_RE = /!\[[^\]]*]\(([^)]+)\)/g;
|
|
11266
11270
|
var YBS_NONZERO_DETAIL_RE = /https:\/\/yaditest\.yitaiyitai\.com\/w:ybs\/project_detail\/(?!0\/)\d+\//;
|
|
@@ -11393,7 +11397,14 @@ async function validateConfigBasis(filePath, caseId, configBasis) {
|
|
|
11393
11397
|
if (missing.length > 0) fail(`${filePath}:${caseId}: \`config_basis\` references missing config location(s): ${missing.join(", ")}`);
|
|
11394
11398
|
}
|
|
11395
11399
|
function parsePrepData(value) {
|
|
11396
|
-
|
|
11400
|
+
return parseStructuredTokens(value, PREP_TOKEN_RE);
|
|
11401
|
+
}
|
|
11402
|
+
function parseTestData(value) {
|
|
11403
|
+
return parseStructuredTokens(value, TEST_DATA_TOKEN_RE);
|
|
11404
|
+
}
|
|
11405
|
+
function parseStructuredTokens(value, tokenPattern) {
|
|
11406
|
+
tokenPattern.lastIndex = 0;
|
|
11407
|
+
const matches = [...value.matchAll(tokenPattern)];
|
|
11397
11408
|
const tokens = {};
|
|
11398
11409
|
matches.forEach((match, index) => {
|
|
11399
11410
|
const start = (match.index ?? 0) + match[0].length;
|
|
@@ -11402,6 +11413,39 @@ function parsePrepData(value) {
|
|
|
11402
11413
|
});
|
|
11403
11414
|
return tokens;
|
|
11404
11415
|
}
|
|
11416
|
+
function validateBusinessTestData(filePath, caseId, row) {
|
|
11417
|
+
const testData = row.test_data.trim();
|
|
11418
|
+
if (!testData) fail(`${filePath}:${caseId}: \`test_data\` is required`);
|
|
11419
|
+
if (SENSITIVE_TEST_DATA_RE.test(testData) || RAW_PAYLOAD_TEST_DATA_RE.test(testData)) {
|
|
11420
|
+
fail(`${filePath}:${caseId}: \`test_data\` must not include token, cookie, phone number, password, Authorization, or raw payload content`);
|
|
11421
|
+
}
|
|
11422
|
+
const requiredTokens = ["\u4E1A\u52A1\u573A\u666F", "\u4E1A\u52A1\u903B\u8F91", "\u6837\u672C\u6570\u636E", "\u5408\u7406\u6027"];
|
|
11423
|
+
const tokens = parseTestData(testData);
|
|
11424
|
+
const missingTokens = requiredTokens.filter((token) => !tokens[token]);
|
|
11425
|
+
if (missingTokens.length > 0) {
|
|
11426
|
+
fail(`${filePath}:${caseId}: \`test_data\` must include ${requiredTokens.map((token) => `${token}=`).join(", ")}`);
|
|
11427
|
+
}
|
|
11428
|
+
for (const chunk of testData.split(";")) {
|
|
11429
|
+
if (chunk.trim() && !chunk.includes("=")) fail(`${filePath}:${caseId}: every \`test_data\` segment must be key=value`);
|
|
11430
|
+
}
|
|
11431
|
+
if (GENERIC_SAMPLE_VALUE_RE.test(tokens["\u6837\u672C\u6570\u636E"])) {
|
|
11432
|
+
fail(`${filePath}:${caseId}: \`test_data\` token \`\u6837\u672C\u6570\u636E=\` must describe customer-realistic business data, not sample/test/mock/placeholder values`);
|
|
11433
|
+
}
|
|
11434
|
+
for (const token of requiredTokens) {
|
|
11435
|
+
if (tokens[token].trim().length < 6) {
|
|
11436
|
+
fail(`${filePath}:${caseId}: \`test_data\` token \`${token}=\` must explain the customer business scenario and logic`);
|
|
11437
|
+
}
|
|
11438
|
+
}
|
|
11439
|
+
const businessContext = [row.title, row.preconditions, row.prep_data, row.steps, row.expected_result].join(" ");
|
|
11440
|
+
const businessScenarioTerms = tokens["\u4E1A\u52A1\u573A\u666F"].split(/[、,,\s]+/).flatMap((word) => {
|
|
11441
|
+
const trimmed = word.trim();
|
|
11442
|
+
if (trimmed.length >= 4) return [trimmed, trimmed.slice(0, 4)];
|
|
11443
|
+
return [trimmed];
|
|
11444
|
+
});
|
|
11445
|
+
if (!businessScenarioTerms.some((word) => word.length >= 2 && businessContext.includes(word))) {
|
|
11446
|
+
fail(`${filePath}:${caseId}: \`test_data\` token \`\u4E1A\u52A1\u573A\u666F=\` must align with the case title, preconditions, steps, or expected result`);
|
|
11447
|
+
}
|
|
11448
|
+
}
|
|
11405
11449
|
async function validateCase(filePath, row, seen) {
|
|
11406
11450
|
const caseId = row.case_id.trim();
|
|
11407
11451
|
if (!caseId) fail(`${filePath}: case_id is required`);
|
|
@@ -11450,6 +11494,7 @@ async function validateCase(filePath, row, seen) {
|
|
|
11450
11494
|
if (UUID_RE.test(browserText)) fail(`${filePath}:${caseId}: browser-executed cases must not use UUID as the execution entrypoint`);
|
|
11451
11495
|
if (YBS_NONZERO_DETAIL_RE.test(browserText)) fail(`${filePath}:${caseId}: YBS detail URLs must use /w:ybs/project_detail/0/<project_id> unless verified otherwise`);
|
|
11452
11496
|
if (YBS_PC_CREATE_WRONG_RE.test(browserText)) fail(`${filePath}:${caseId}: YBS PC create URLs must use /w:ybs/project/create?flow_type=<flow_type>`);
|
|
11497
|
+
validateBusinessTestData(filePath, caseId, row);
|
|
11453
11498
|
}
|
|
11454
11499
|
async function scenarioDirs(root) {
|
|
11455
11500
|
if (!await exists2(root)) return [];
|