|
f7eb47b…
|
lmata
|
1 |
"use strict"; |
|
f7eb47b…
|
lmata
|
2 |
var __create = Object.create; |
|
f7eb47b…
|
lmata
|
3 |
var __defProp = Object.defineProperty; |
|
f7eb47b…
|
lmata
|
4 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
|
f7eb47b…
|
lmata
|
5 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
|
f7eb47b…
|
lmata
|
6 |
var __getProtoOf = Object.getPrototypeOf; |
|
f7eb47b…
|
lmata
|
7 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
|
f7eb47b…
|
lmata
|
8 |
var __export = (target, all) => { |
|
f7eb47b…
|
lmata
|
9 |
for (var name in all) |
|
f7eb47b…
|
lmata
|
10 |
__defProp(target, name, { get: all[name], enumerable: true }); |
|
f7eb47b…
|
lmata
|
11 |
}; |
|
f7eb47b…
|
lmata
|
12 |
var __copyProps = (to, from, except, desc) => { |
|
f7eb47b…
|
lmata
|
13 |
if (from && typeof from === "object" || typeof from === "function") { |
|
f7eb47b…
|
lmata
|
14 |
for (let key of __getOwnPropNames(from)) |
|
f7eb47b…
|
lmata
|
15 |
if (!__hasOwnProp.call(to, key) && key !== except) |
|
f7eb47b…
|
lmata
|
16 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
|
f7eb47b…
|
lmata
|
17 |
} |
|
f7eb47b…
|
lmata
|
18 |
return to; |
|
f7eb47b…
|
lmata
|
19 |
}; |
|
f7eb47b…
|
lmata
|
20 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
|
f7eb47b…
|
lmata
|
21 |
// If the importer is in node compatibility mode or this is not an ESM |
|
f7eb47b…
|
lmata
|
22 |
// file that has been converted to a CommonJS file using a Babel- |
|
f7eb47b…
|
lmata
|
23 |
// compatible transform (i.e. "__esModule" has not been set), then set |
|
f7eb47b…
|
lmata
|
24 |
// "default" to the CommonJS "module.exports" for node compatibility. |
|
f7eb47b…
|
lmata
|
25 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
|
f7eb47b…
|
lmata
|
26 |
mod |
|
f7eb47b…
|
lmata
|
27 |
)); |
|
f7eb47b…
|
lmata
|
28 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
|
f7eb47b…
|
lmata
|
29 |
var suiteUtils_exports = {}; |
|
f7eb47b…
|
lmata
|
30 |
__export(suiteUtils_exports, { |
|
f7eb47b…
|
lmata
|
31 |
applyRepeatEachIndex: () => applyRepeatEachIndex, |
|
f7eb47b…
|
lmata
|
32 |
bindFileSuiteToProject: () => bindFileSuiteToProject, |
|
f7eb47b…
|
lmata
|
33 |
filterByFocusedLine: () => filterByFocusedLine, |
|
f7eb47b…
|
lmata
|
34 |
filterOnly: () => filterOnly, |
|
f7eb47b…
|
lmata
|
35 |
filterSuite: () => filterSuite, |
|
f7eb47b…
|
lmata
|
36 |
filterTestsRemoveEmptySuites: () => filterTestsRemoveEmptySuites |
|
f7eb47b…
|
lmata
|
37 |
}); |
|
f7eb47b…
|
lmata
|
38 |
module.exports = __toCommonJS(suiteUtils_exports); |
|
f7eb47b…
|
lmata
|
39 |
var import_path = __toESM(require("path")); |
|
f7eb47b…
|
lmata
|
40 |
var import_utils = require("playwright-core/lib/utils"); |
|
f7eb47b…
|
lmata
|
41 |
var import_util = require("../util"); |
|
f7eb47b…
|
lmata
|
42 |
function filterSuite(suite, suiteFilter, testFilter) { |
|
f7eb47b…
|
lmata
|
43 |
for (const child of suite.suites) { |
|
f7eb47b…
|
lmata
|
44 |
if (!suiteFilter(child)) |
|
f7eb47b…
|
lmata
|
45 |
filterSuite(child, suiteFilter, testFilter); |
|
f7eb47b…
|
lmata
|
46 |
} |
|
f7eb47b…
|
lmata
|
47 |
const filteredTests = suite.tests.filter(testFilter); |
|
f7eb47b…
|
lmata
|
48 |
const entries = /* @__PURE__ */ new Set([...suite.suites, ...filteredTests]); |
|
f7eb47b…
|
lmata
|
49 |
suite._entries = suite._entries.filter((e) => entries.has(e)); |
|
f7eb47b…
|
lmata
|
50 |
} |
|
f7eb47b…
|
lmata
|
51 |
function filterTestsRemoveEmptySuites(suite, filter) { |
|
f7eb47b…
|
lmata
|
52 |
const filteredSuites = suite.suites.filter((child) => filterTestsRemoveEmptySuites(child, filter)); |
|
f7eb47b…
|
lmata
|
53 |
const filteredTests = suite.tests.filter(filter); |
|
f7eb47b…
|
lmata
|
54 |
const entries = /* @__PURE__ */ new Set([...filteredSuites, ...filteredTests]); |
|
f7eb47b…
|
lmata
|
55 |
suite._entries = suite._entries.filter((e) => entries.has(e)); |
|
f7eb47b…
|
lmata
|
56 |
return !!suite._entries.length; |
|
f7eb47b…
|
lmata
|
57 |
} |
|
f7eb47b…
|
lmata
|
58 |
function bindFileSuiteToProject(project, suite) { |
|
f7eb47b…
|
lmata
|
59 |
const relativeFile = import_path.default.relative(project.project.testDir, suite.location.file); |
|
f7eb47b…
|
lmata
|
60 |
const fileId = (0, import_utils.calculateSha1)((0, import_utils.toPosixPath)(relativeFile)).slice(0, 20); |
|
f7eb47b…
|
lmata
|
61 |
const result = suite._deepClone(); |
|
f7eb47b…
|
lmata
|
62 |
result._fileId = fileId; |
|
f7eb47b…
|
lmata
|
63 |
result.forEachTest((test, suite2) => { |
|
f7eb47b…
|
lmata
|
64 |
suite2._fileId = fileId; |
|
f7eb47b…
|
lmata
|
65 |
const [file, ...titles] = test.titlePath(); |
|
f7eb47b…
|
lmata
|
66 |
const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)} |
|
f7eb47b…
|
lmata
|
67 |
const testId = fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20); |
|
f7eb47b…
|
lmata
|
68 |
test.id = testId; |
|
f7eb47b…
|
lmata
|
69 |
test._projectId = project.id; |
|
f7eb47b…
|
lmata
|
70 |
let inheritedRetries; |
|
f7eb47b…
|
lmata
|
71 |
let inheritedTimeout; |
|
f7eb47b…
|
lmata
|
72 |
for (let parentSuite = suite2; parentSuite; parentSuite = parentSuite.parent) { |
|
f7eb47b…
|
lmata
|
73 |
if (parentSuite._staticAnnotations.length) |
|
f7eb47b…
|
lmata
|
74 |
test.annotations.unshift(...parentSuite._staticAnnotations); |
|
f7eb47b…
|
lmata
|
75 |
if (inheritedRetries === void 0 && parentSuite._retries !== void 0) |
|
f7eb47b…
|
lmata
|
76 |
inheritedRetries = parentSuite._retries; |
|
f7eb47b…
|
lmata
|
77 |
if (inheritedTimeout === void 0 && parentSuite._timeout !== void 0) |
|
f7eb47b…
|
lmata
|
78 |
inheritedTimeout = parentSuite._timeout; |
|
f7eb47b…
|
lmata
|
79 |
} |
|
f7eb47b…
|
lmata
|
80 |
test.retries = inheritedRetries ?? project.project.retries; |
|
f7eb47b…
|
lmata
|
81 |
test.timeout = inheritedTimeout ?? project.project.timeout; |
|
f7eb47b…
|
lmata
|
82 |
if (test.annotations.some((a) => a.type === "skip" || a.type === "fixme")) |
|
f7eb47b…
|
lmata
|
83 |
test.expectedStatus = "skipped"; |
|
f7eb47b…
|
lmata
|
84 |
if (test._poolDigest) |
|
f7eb47b…
|
lmata
|
85 |
test._workerHash = `${project.id}-${test._poolDigest}-0`; |
|
f7eb47b…
|
lmata
|
86 |
}); |
|
f7eb47b…
|
lmata
|
87 |
return result; |
|
f7eb47b…
|
lmata
|
88 |
} |
|
f7eb47b…
|
lmata
|
89 |
function applyRepeatEachIndex(project, fileSuite, repeatEachIndex) { |
|
f7eb47b…
|
lmata
|
90 |
fileSuite.forEachTest((test, suite) => { |
|
f7eb47b…
|
lmata
|
91 |
if (repeatEachIndex) { |
|
f7eb47b…
|
lmata
|
92 |
const [file, ...titles] = test.titlePath(); |
|
f7eb47b…
|
lmata
|
93 |
const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)} |
|
f7eb47b…
|
lmata
|
94 |
const testId = suite._fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20); |
|
f7eb47b…
|
lmata
|
95 |
test.id = testId; |
|
f7eb47b…
|
lmata
|
96 |
test.repeatEachIndex = repeatEachIndex; |
|
f7eb47b…
|
lmata
|
97 |
if (test._poolDigest) |
|
f7eb47b…
|
lmata
|
98 |
test._workerHash = `${project.id}-${test._poolDigest}-${repeatEachIndex}`; |
|
f7eb47b…
|
lmata
|
99 |
} |
|
f7eb47b…
|
lmata
|
100 |
}); |
|
f7eb47b…
|
lmata
|
101 |
} |
|
f7eb47b…
|
lmata
|
102 |
function filterOnly(suite) { |
|
f7eb47b…
|
lmata
|
103 |
if (!suite._getOnlyItems().length) |
|
f7eb47b…
|
lmata
|
104 |
return; |
|
f7eb47b…
|
lmata
|
105 |
const suiteFilter = (suite2) => suite2._only; |
|
f7eb47b…
|
lmata
|
106 |
const testFilter = (test) => test._only; |
|
f7eb47b…
|
lmata
|
107 |
return filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter); |
|
f7eb47b…
|
lmata
|
108 |
} |
|
f7eb47b…
|
lmata
|
109 |
function filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter) { |
|
f7eb47b…
|
lmata
|
110 |
const onlySuites = suite.suites.filter((child) => filterSuiteWithOnlySemantics(child, suiteFilter, testFilter) || suiteFilter(child)); |
|
f7eb47b…
|
lmata
|
111 |
const onlyTests = suite.tests.filter(testFilter); |
|
f7eb47b…
|
lmata
|
112 |
const onlyEntries = /* @__PURE__ */ new Set([...onlySuites, ...onlyTests]); |
|
f7eb47b…
|
lmata
|
113 |
if (onlyEntries.size) { |
|
f7eb47b…
|
lmata
|
114 |
suite._entries = suite._entries.filter((e) => onlyEntries.has(e)); |
|
f7eb47b…
|
lmata
|
115 |
return true; |
|
f7eb47b…
|
lmata
|
116 |
} |
|
f7eb47b…
|
lmata
|
117 |
return false; |
|
f7eb47b…
|
lmata
|
118 |
} |
|
f7eb47b…
|
lmata
|
119 |
function filterByFocusedLine(suite, focusedTestFileLines) { |
|
f7eb47b…
|
lmata
|
120 |
if (!focusedTestFileLines.length) |
|
f7eb47b…
|
lmata
|
121 |
return; |
|
f7eb47b…
|
lmata
|
122 |
const matchers = focusedTestFileLines.map(createFileMatcherFromFilter); |
|
f7eb47b…
|
lmata
|
123 |
const testFileLineMatches = (testFileName, testLine, testColumn) => matchers.some((m) => m(testFileName, testLine, testColumn)); |
|
f7eb47b…
|
lmata
|
124 |
const suiteFilter = (suite2) => !!suite2.location && testFileLineMatches(suite2.location.file, suite2.location.line, suite2.location.column); |
|
f7eb47b…
|
lmata
|
125 |
const testFilter = (test) => testFileLineMatches(test.location.file, test.location.line, test.location.column); |
|
f7eb47b…
|
lmata
|
126 |
return filterSuite(suite, suiteFilter, testFilter); |
|
f7eb47b…
|
lmata
|
127 |
} |
|
f7eb47b…
|
lmata
|
128 |
function createFileMatcherFromFilter(filter) { |
|
f7eb47b…
|
lmata
|
129 |
const fileMatcher = (0, import_util.createFileMatcher)(filter.re || filter.exact || ""); |
|
f7eb47b…
|
lmata
|
130 |
return (testFileName, testLine, testColumn) => fileMatcher(testFileName) && (filter.line === testLine || filter.line === null) && (filter.column === testColumn || filter.column === null); |
|
f7eb47b…
|
lmata
|
131 |
} |
|
f7eb47b…
|
lmata
|
132 |
// Annotate the CommonJS export names for ESM import in node: |
|
f7eb47b…
|
lmata
|
133 |
0 && (module.exports = { |
|
f7eb47b…
|
lmata
|
134 |
applyRepeatEachIndex, |
|
f7eb47b…
|
lmata
|
135 |
bindFileSuiteToProject, |
|
f7eb47b…
|
lmata
|
136 |
filterByFocusedLine, |
|
f7eb47b…
|
lmata
|
137 |
filterOnly, |
|
f7eb47b…
|
lmata
|
138 |
filterSuite, |
|
f7eb47b…
|
lmata
|
139 |
filterTestsRemoveEmptySuites |
|
f7eb47b…
|
lmata
|
140 |
}); |