test(e2e): форматировать сгенерированные json/md evidence prettier
Зачем: tests/e2e/evidence не входит в .prettierignore (файл вне разрешённых путей), и минифицированный JSON vitest делал бы npm run format:check красным из-за артефактов, а не из-за кода.
This commit is contained in:
parent
32ced4b100
commit
9bdfb66a53
1 changed files with 7 additions and 1 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
// убрать из списка — иначе регрессию потом никто не заметит).
|
// убрать из списка — иначе регрессию потом никто не заметит).
|
||||||
// * --no-known-defects: строгий режим, exit = код vitest (все дефекты красные).
|
// * --no-known-defects: строгий режим, exit = код vitest (все дефекты красные).
|
||||||
// Полный вывод пишется в tests/e2e/evidence/e2e-run.txt, таблица — в e2e-table.md.
|
// Полный вывод пишется в tests/e2e/evidence/e2e-run.txt, таблица — в e2e-table.md.
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn, spawnSync } from 'node:child_process';
|
||||||
import { createWriteStream, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
import { createWriteStream, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
|
|
@ -106,6 +106,12 @@ for (const id of Object.keys(known)) {
|
||||||
}
|
}
|
||||||
const table = ['| ID | Цвет | Зелёных/всего | Вердикт |', '|---|---|---|---|', ...rows].join('\n');
|
const table = ['| ID | Цвет | Зелёных/всего | Вердикт |', '|---|---|---|---|', ...rows].join('\n');
|
||||||
writeFileSync(path.join(evidence, 'e2e-table.md'), `${table}\n`);
|
writeFileSync(path.join(evidence, 'e2e-table.md'), `${table}\n`);
|
||||||
|
// Сгенерированные json/md приводятся к prettier, чтобы `npm run format:check` не
|
||||||
|
// краснел из-за evidence (tests/e2e/evidence не в .prettierignore).
|
||||||
|
spawnSync('npx', ['prettier', '--write', jsonPath, path.join(evidence, 'e2e-table.md')], {
|
||||||
|
cwd: repoRoot,
|
||||||
|
stdio: 'ignore',
|
||||||
|
});
|
||||||
console.log(`\n[run-e2e] vitest exit=${exitCode}\n${table}`);
|
console.log(`\n[run-e2e] vitest exit=${exitCode}\n${table}`);
|
||||||
|
|
||||||
if (strict) {
|
if (strict) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue