UNPKG

e2ed

Version:

E2E testing framework over Playwright

37 lines (36 loc) 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUnsuccessfulTestFilePaths = void 0; const asserts_1 = require("../asserts"); const generalLog_1 = require("../generalLog"); /** * Get unsuccessful test file paths, that is, file paths that are not successful and included in pack. * @internal */ const getUnsuccessfulTestFilePaths = async (allTestFilePaths, notIncludedInPackTests) => { const successfulTestFilePaths = await (0, generalLog_1.getSuccessfulTestFilePaths)(); const successfulAndNotIncludedTestFilePathsHash = Object.create(null); for (const filePath of successfulTestFilePaths) { successfulAndNotIncludedTestFilePathsHash[filePath] = true; } for (const filePath of notIncludedInPackTests) { (0, asserts_1.assertValueIsFalse)(filePath in successfulAndNotIncludedTestFilePathsHash, 'There is no intersection between successful tests and not included in pack tests', { filePath, notIncludedInPackTests, successfulAndNotIncludedTestFilePathsHash }); successfulAndNotIncludedTestFilePathsHash[filePath] = true; } const allTestFilePathsHash = Object.create(null); for (const filePath of allTestFilePaths) { allTestFilePathsHash[filePath] = true; } // eslint-disable-next-line guard-for-in for (const filePath in successfulAndNotIncludedTestFilePathsHash) { (0, asserts_1.assertValueIsTrue)(filePath in allTestFilePathsHash, 'filePath included in allTestFilePathsHash', { allTestFilePathsHash, filePath }); } const unsuccessfulTestFilePaths = []; for (const filePath of allTestFilePaths) { if (!(filePath in successfulAndNotIncludedTestFilePathsHash)) { unsuccessfulTestFilePaths.push(filePath); } } return unsuccessfulTestFilePaths; }; exports.getUnsuccessfulTestFilePaths = getUnsuccessfulTestFilePaths;