Например, при выполнении следующей команды средство запуска тестов выведет результаты теста на стандартный вывод в формате спецификации и запишет XML-отчет в стиле JUnit в файл junit.xml:
Код: Выделить всё
node --test --test-reporter spec --test-reporter-destination stdout --test-reporter junit --test-reporter-destination ./report.xml
Код: Выделить всё
import { join } from "node:path";
import { run } from "node:test";
import { spec } from "node:test/reporters";
run({ files: [join(import.meta.dirname, "test", "my.test.js")] })
.compose(spec)
.pipe(process.stdout);
Подробнее здесь: https://stackoverflow.com/questions/793 ... e-reporter
Мобильная версия