e2ed
Version:
E2E testing framework over Playwright
24 lines (23 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIsTestFilePathUniq = void 0;
const fs_1 = require("../fs");
const getIsTestOptionsDifferent_1 = require("./getIsTestOptionsDifferent");
/**
* Returns `true`, if new test file path is uniq in completed test runs,
* otherwise writes global error.
* @internal
*/
const getIsTestFilePathUniq = async (testStaticOptions, completedTestRuns) => {
const { filePath, name, options } = testStaticOptions;
const testRunsWithFilePath = completedTestRuns.filter((run) => run.filePath === filePath);
for (const completedTestRun of testRunsWithFilePath) {
if (name !== completedTestRun.name ||
(0, getIsTestOptionsDifferent_1.getIsTestOptionsDifferent)(options, completedTestRun.options)) {
await (0, fs_1.writeGlobalError)(`The file "${filePath}" contains two different tests: "${completedTestRun.name}" (${JSON.stringify(completedTestRun.options)}) and "${name}" (${JSON.stringify(options)})`);
return false;
}
}
return true;
};
exports.getIsTestFilePathUniq = getIsTestFilePathUniq;