fix: cleanup version in e2e tests (#503)

This commit is contained in:
Andriy Leliv
2022-01-10 17:07:58 +02:00
committed by GitHub
parent 3687ebf4c4
commit aeef689d6f
2 changed files with 7 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ exports[`E2E bundle lint format bundle lint: should be formatted by format: json
"warnings": 0,
"ignored": 0
},
"version": "1.0.0-beta.78",
"version": "<version>",
"problems": [
{
"ruleId": "spec",
@@ -31,7 +31,7 @@ exports[`E2E bundle lint format bundle lint: should be formatted by format: json
"warnings": 0,
"ignored": 0
},
"version": "1.0.0-beta.78",
"version": "<version>",
"problems": []
}
No configurations were defined in extends -- using built in recommended configuration by default.

View File

@@ -13,9 +13,13 @@ expect.extend({
addSerializer({
test: (val: any) => typeof val === 'string',
print: (v: any) => v as string,
print: (v: any) => cleanUpVersion(v),
});
function cleanUpVersion(str: string): string {
return str.replace(/"version":\s(\".*\")*/g, '"version": "<version>"');
}
function getEntrypoints(folderPath: string) {
const redoclyYamlFile = readFileSync(join(folderPath, ".redocly.yaml"), "utf8");
const redoclyYaml = parseYaml(redoclyYamlFile) as { apiDefinitions: Record<string, string>; };