@smoothdeploy/playwright 1.57.1 → 1.58.1-beta-1770383926000

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @smoothdeploy/playwright might be problematic. Click here for more details.

Files changed (264) hide show
  1. package/ThirdPartyNotices.txt +1188 -65
  2. package/lib/agents/agentParser.js +89 -0
  3. package/lib/agents/generateAgents.js +27 -74
  4. package/lib/agents/generateAgents.js.map +7 -0
  5. package/lib/agents/playwright-test-planner.agent.md +1 -0
  6. package/lib/common/config.js +6 -4
  7. package/lib/common/config.js.map +7 -0
  8. package/lib/common/configLoader.js.map +7 -0
  9. package/lib/common/esmLoaderHost.js +2 -0
  10. package/lib/common/esmLoaderHost.js.map +7 -0
  11. package/lib/common/expectBundle.js +2 -17
  12. package/lib/common/expectBundle.js.map +7 -0
  13. package/lib/common/expectBundleImpl.js +132 -132
  14. package/lib/common/expectBundleImpl.js.map +7 -0
  15. package/lib/common/fixtures.js.map +7 -0
  16. package/lib/common/globals.js.map +7 -0
  17. package/lib/common/ipc.js.map +7 -0
  18. package/lib/common/poolBuilder.js.map +7 -0
  19. package/lib/common/process.js +28 -0
  20. package/lib/common/process.js.map +7 -0
  21. package/lib/common/suiteUtils.js.map +7 -0
  22. package/lib/common/test.js.map +7 -0
  23. package/lib/common/testLoader.js.map +7 -0
  24. package/lib/common/testType.js.map +7 -0
  25. package/lib/common/validators.js +10 -10
  26. package/lib/common/validators.js.map +7 -0
  27. package/lib/fsWatcher.js.map +7 -0
  28. package/lib/index.js +205 -12
  29. package/lib/index.js.map +7 -0
  30. package/lib/internalsForTest.js.map +7 -0
  31. package/lib/isomorphic/events.js.map +7 -0
  32. package/lib/isomorphic/folders.js.map +7 -0
  33. package/lib/isomorphic/stringInternPool.js.map +7 -0
  34. package/lib/isomorphic/teleReceiver.js +15 -2
  35. package/lib/isomorphic/teleReceiver.js.map +7 -0
  36. package/lib/isomorphic/teleSuiteUpdater.js +24 -4
  37. package/lib/isomorphic/teleSuiteUpdater.js.map +7 -0
  38. package/lib/isomorphic/testServerConnection.js.map +7 -0
  39. package/lib/isomorphic/testServerInterface.js.map +7 -0
  40. package/lib/isomorphic/testTree.js +13 -18
  41. package/lib/isomorphic/testTree.js.map +7 -0
  42. package/lib/isomorphic/types.d.js.map +7 -0
  43. package/lib/loader/loaderMain.js.map +7 -0
  44. package/lib/matchers/expect.js +2 -15
  45. package/lib/matchers/expect.js.map +7 -0
  46. package/lib/matchers/matcherHint.js +1 -44
  47. package/lib/matchers/matcherHint.js.map +7 -0
  48. package/lib/matchers/matchers.js +3 -2
  49. package/lib/matchers/matchers.js.map +7 -0
  50. package/lib/matchers/toBeTruthy.js +5 -3
  51. package/lib/matchers/toBeTruthy.js.map +7 -0
  52. package/lib/matchers/toEqual.js +4 -3
  53. package/lib/matchers/toEqual.js.map +7 -0
  54. package/lib/matchers/toHaveURL.js +5 -6
  55. package/lib/matchers/toHaveURL.js.map +7 -0
  56. package/lib/matchers/toMatchAriaSnapshot.js +5 -5
  57. package/lib/matchers/toMatchAriaSnapshot.js.map +7 -0
  58. package/lib/matchers/toMatchSnapshot.js +9 -8
  59. package/lib/matchers/toMatchSnapshot.js.map +7 -0
  60. package/lib/matchers/toMatchText.js +9 -9
  61. package/lib/matchers/toMatchText.js.map +7 -0
  62. package/lib/mcp/browser/actions.d.js.map +7 -0
  63. package/lib/mcp/browser/browserContextFactory.js +62 -29
  64. package/lib/mcp/browser/browserContextFactory.js.map +7 -0
  65. package/lib/mcp/browser/browserServerBackend.js +17 -9
  66. package/lib/mcp/browser/browserServerBackend.js.map +7 -0
  67. package/lib/mcp/browser/codegen.js.map +7 -0
  68. package/lib/mcp/browser/config.js +65 -12
  69. package/lib/mcp/browser/config.js.map +7 -0
  70. package/lib/mcp/browser/context.js +71 -94
  71. package/lib/mcp/browser/context.js.map +7 -0
  72. package/lib/mcp/browser/response.js +172 -131
  73. package/lib/mcp/browser/response.js.map +7 -0
  74. package/lib/mcp/browser/sessionLog.js +19 -104
  75. package/lib/mcp/browser/sessionLog.js.map +7 -0
  76. package/lib/mcp/browser/tab.js +92 -41
  77. package/lib/mcp/browser/tab.js.map +7 -0
  78. package/lib/mcp/browser/tools/common.js +8 -6
  79. package/lib/mcp/browser/tools/common.js.map +7 -0
  80. package/lib/mcp/browser/tools/console.js +7 -5
  81. package/lib/mcp/browser/tools/console.js.map +7 -0
  82. package/lib/mcp/browser/tools/dialogs.js +4 -4
  83. package/lib/mcp/browser/tools/dialogs.js.map +7 -0
  84. package/lib/mcp/browser/tools/evaluate.js +11 -19
  85. package/lib/mcp/browser/tools/evaluate.js.map +7 -0
  86. package/lib/mcp/browser/tools/files.js +3 -3
  87. package/lib/mcp/browser/tools/files.js.map +7 -0
  88. package/lib/mcp/browser/tools/form.js +9 -19
  89. package/lib/mcp/browser/tools/form.js.map +7 -0
  90. package/lib/mcp/browser/tools/install.js +6 -3
  91. package/lib/mcp/browser/tools/install.js.map +7 -0
  92. package/lib/mcp/browser/tools/keyboard.js +34 -11
  93. package/lib/mcp/browser/tools/keyboard.js.map +7 -0
  94. package/lib/mcp/browser/tools/mouse.js +11 -11
  95. package/lib/mcp/browser/tools/mouse.js.map +7 -0
  96. package/lib/mcp/browser/tools/navigate.js +14 -5
  97. package/lib/mcp/browser/tools/navigate.js.map +7 -0
  98. package/lib/mcp/browser/tools/network.js +20 -11
  99. package/lib/mcp/browser/tools/network.js.map +7 -0
  100. package/lib/mcp/browser/tools/open.js +57 -0
  101. package/lib/mcp/browser/tools/pdf.js +9 -19
  102. package/lib/mcp/browser/tools/pdf.js.map +7 -0
  103. package/lib/mcp/browser/tools/runCode.js +11 -8
  104. package/lib/mcp/browser/tools/runCode.js.map +7 -0
  105. package/lib/mcp/browser/tools/screenshot.js +16 -29
  106. package/lib/mcp/browser/tools/screenshot.js.map +7 -0
  107. package/lib/mcp/browser/tools/snapshot.js +21 -29
  108. package/lib/mcp/browser/tools/snapshot.js.map +7 -0
  109. package/lib/mcp/browser/tools/tabs.js +12 -12
  110. package/lib/mcp/browser/tools/tabs.js.map +7 -0
  111. package/lib/mcp/browser/tools/tool.js +2 -4
  112. package/lib/mcp/browser/tools/tool.js.map +7 -0
  113. package/lib/mcp/browser/tools/tracing.js +6 -6
  114. package/lib/mcp/browser/tools/tracing.js.map +7 -0
  115. package/lib/mcp/browser/tools/utils.js +49 -44
  116. package/lib/mcp/browser/tools/utils.js.map +7 -0
  117. package/lib/mcp/browser/tools/verify.js +24 -34
  118. package/lib/mcp/browser/tools/verify.js.map +7 -0
  119. package/lib/mcp/browser/tools/wait.js +6 -6
  120. package/lib/mcp/browser/tools/wait.js.map +7 -0
  121. package/lib/mcp/browser/tools.js +3 -1
  122. package/lib/mcp/browser/tools.js.map +7 -0
  123. package/lib/mcp/browser/watchdog.js.map +7 -0
  124. package/lib/mcp/config.d.js.map +7 -0
  125. package/lib/mcp/extension/cdpRelay.js +1 -1
  126. package/lib/mcp/extension/cdpRelay.js.map +7 -0
  127. package/lib/mcp/extension/extensionContextFactory.js +6 -5
  128. package/lib/mcp/extension/extensionContextFactory.js.map +7 -0
  129. package/lib/mcp/extension/protocol.js.map +7 -0
  130. package/lib/mcp/index.js.map +7 -0
  131. package/lib/mcp/log.js.map +7 -0
  132. package/lib/mcp/program.js +15 -20
  133. package/lib/mcp/program.js.map +7 -0
  134. package/lib/mcp/sdk/bundle.js.map +7 -0
  135. package/lib/mcp/sdk/exports.js +0 -2
  136. package/lib/mcp/sdk/exports.js.map +7 -0
  137. package/lib/mcp/sdk/http.js +20 -55
  138. package/lib/mcp/sdk/http.js.map +7 -0
  139. package/lib/mcp/sdk/inProcessTransport.js.map +7 -0
  140. package/lib/mcp/sdk/proxyBackend.js.map +7 -0
  141. package/lib/mcp/sdk/server.js +29 -4
  142. package/lib/mcp/sdk/server.js.map +7 -0
  143. package/lib/mcp/sdk/tool.js +2 -2
  144. package/lib/mcp/sdk/tool.js.map +7 -0
  145. package/lib/mcp/terminal/cli.js +296 -0
  146. package/lib/mcp/terminal/command.js +56 -0
  147. package/lib/mcp/terminal/commands.js +333 -0
  148. package/lib/mcp/terminal/daemon.js +129 -0
  149. package/lib/mcp/terminal/help.json +32 -0
  150. package/lib/mcp/terminal/helpGenerator.js +88 -0
  151. package/lib/mcp/terminal/socketConnection.js +80 -0
  152. package/lib/mcp/test/browserBackend.js +3 -13
  153. package/lib/mcp/test/browserBackend.js.map +7 -0
  154. package/lib/mcp/test/generatorTools.js +9 -9
  155. package/lib/mcp/test/generatorTools.js.map +7 -0
  156. package/lib/mcp/test/plannerTools.js +23 -22
  157. package/lib/mcp/test/plannerTools.js.map +7 -0
  158. package/lib/mcp/test/seed.js.map +7 -0
  159. package/lib/mcp/test/streams.js.map +7 -0
  160. package/lib/mcp/test/testBackend.js +6 -6
  161. package/lib/mcp/test/testBackend.js.map +7 -0
  162. package/lib/mcp/test/testContext.js +9 -3
  163. package/lib/mcp/test/testContext.js.map +7 -0
  164. package/lib/mcp/test/testTool.js.map +7 -0
  165. package/lib/mcp/test/testTools.js +12 -10
  166. package/lib/mcp/test/testTools.js.map +7 -0
  167. package/lib/mcpBundleImpl.js.map +7 -0
  168. package/lib/plugins/gitCommitInfoPlugin.js.map +7 -0
  169. package/lib/plugins/index.js.map +7 -0
  170. package/lib/plugins/webServerPlugin.js.map +7 -0
  171. package/lib/program.js +18 -4
  172. package/lib/program.js.map +7 -0
  173. package/lib/reporters/base.js +29 -4
  174. package/lib/reporters/base.js.map +7 -0
  175. package/lib/reporters/blob.js +3 -0
  176. package/lib/reporters/blob.js.map +7 -0
  177. package/lib/reporters/dot.js +17 -0
  178. package/lib/reporters/dot.js.map +7 -0
  179. package/lib/reporters/empty.js.map +7 -0
  180. package/lib/reporters/github.js.map +7 -0
  181. package/lib/reporters/html.js +13 -3
  182. package/lib/reporters/html.js.map +7 -0
  183. package/lib/reporters/internalReporter.js +6 -0
  184. package/lib/reporters/internalReporter.js.map +7 -0
  185. package/lib/reporters/json.js.map +7 -0
  186. package/lib/reporters/junit.js.map +7 -0
  187. package/lib/reporters/line.js +18 -0
  188. package/lib/reporters/line.js.map +7 -0
  189. package/lib/reporters/list.js +22 -0
  190. package/lib/reporters/list.js.map +7 -0
  191. package/lib/reporters/listModeReporter.js.map +7 -0
  192. package/lib/reporters/markdown.js.map +7 -0
  193. package/lib/reporters/merge.js +25 -8
  194. package/lib/reporters/merge.js.map +7 -0
  195. package/lib/reporters/multiplexer.js +8 -0
  196. package/lib/reporters/multiplexer.js.map +7 -0
  197. package/lib/reporters/reporterV2.js.map +7 -0
  198. package/lib/reporters/smoothdeploy.js +191 -0
  199. package/lib/reporters/teleEmitter.js +22 -4
  200. package/lib/reporters/teleEmitter.js.map +7 -0
  201. package/lib/reporters/versions/blobV1.js.map +7 -0
  202. package/lib/runner/dispatcher.js +20 -4
  203. package/lib/runner/dispatcher.js.map +7 -0
  204. package/lib/runner/failureTracker.js.map +7 -0
  205. package/lib/runner/lastRun.js.map +7 -0
  206. package/lib/runner/loadUtils.js +2 -2
  207. package/lib/runner/loadUtils.js.map +7 -0
  208. package/lib/runner/loaderHost.js.map +7 -0
  209. package/lib/runner/processHost.js +19 -0
  210. package/lib/runner/processHost.js.map +7 -0
  211. package/lib/runner/projectUtils.js +1 -1
  212. package/lib/runner/projectUtils.js.map +7 -0
  213. package/lib/runner/rebase.js.map +7 -0
  214. package/lib/runner/reporters.js +3 -1
  215. package/lib/runner/reporters.js.map +7 -0
  216. package/lib/runner/sigIntWatcher.js.map +7 -0
  217. package/lib/runner/storage.js +91 -0
  218. package/lib/runner/taskRunner.js.map +7 -0
  219. package/lib/runner/tasks.js.map +7 -0
  220. package/lib/runner/testGroups.js +14 -6
  221. package/lib/runner/testGroups.js.map +7 -0
  222. package/lib/runner/testRunner.js +13 -4
  223. package/lib/runner/testRunner.js.map +7 -0
  224. package/lib/runner/testServer.js +2 -2
  225. package/lib/runner/testServer.js.map +7 -0
  226. package/lib/runner/uiModeReporter.js.map +7 -0
  227. package/lib/runner/vcs.js.map +7 -0
  228. package/lib/runner/watchMode.js +2 -1
  229. package/lib/runner/watchMode.js.map +7 -0
  230. package/lib/runner/workerHost.js +6 -0
  231. package/lib/runner/workerHost.js.map +7 -0
  232. package/lib/third_party/pirates.js.map +7 -0
  233. package/lib/third_party/tsconfig-loader.js.map +7 -0
  234. package/lib/transform/babelBundle.js +3 -0
  235. package/lib/transform/babelBundle.js.map +7 -0
  236. package/lib/transform/babelBundleImpl.js +134 -134
  237. package/lib/transform/babelBundleImpl.js.map +7 -0
  238. package/lib/transform/compilationCache.js +2 -0
  239. package/lib/transform/compilationCache.js.map +7 -0
  240. package/lib/transform/esmLoader.js +10 -11
  241. package/lib/transform/esmLoader.js.map +7 -0
  242. package/lib/transform/md.js +221 -0
  243. package/lib/transform/portTransport.js.map +7 -0
  244. package/lib/transform/transform.js +18 -8
  245. package/lib/transform/transform.js.map +7 -0
  246. package/lib/util.js +3 -6
  247. package/lib/util.js.map +7 -0
  248. package/lib/utilsBundle.js +7 -0
  249. package/lib/utilsBundle.js.map +7 -0
  250. package/lib/utilsBundleImpl.js +51 -48
  251. package/lib/utilsBundleImpl.js.map +7 -0
  252. package/lib/worker/fixtureRunner.js +6 -2
  253. package/lib/worker/fixtureRunner.js.map +7 -0
  254. package/lib/worker/testInfo.js +39 -19
  255. package/lib/worker/testInfo.js.map +7 -0
  256. package/lib/worker/testTracing.js.map +7 -0
  257. package/lib/worker/timeoutManager.js.map +7 -0
  258. package/lib/worker/util.js.map +7 -0
  259. package/lib/worker/workerMain.js +17 -16
  260. package/lib/worker/workerMain.js.map +7 -0
  261. package/package.json +2 -2
  262. package/test.mjs +1 -0
  263. package/types/test.d.ts +26 -6
  264. package/types/testReporter.d.ts +1 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/loadUtils.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from 'path';\nimport fs from 'fs';\nimport { toPosixPath } from 'playwright-core/lib/utils';\n\nimport { InProcessLoaderHost, OutOfProcessLoaderHost } from './loaderHost';\nimport { createFileFiltersFromArguments, createFileMatcherFromArguments, createTitleMatcher, errorWithFile, forceRegExp, parseLocationArg } from '../util';\nimport { buildProjectsClosure, collectFilesForProject, filterProjects } from './projectUtils';\nimport { createTestGroups, filterForShard } from './testGroups';\nimport { applyRepeatEachIndex, bindFileSuiteToProject, filterByFocusedLine, filterOnly, filterTestsRemoveEmptySuites } from '../common/suiteUtils';\nimport { Suite } from '../common/test';\nimport { dependenciesForTestFile } from '../transform/compilationCache';\nimport { requireOrImport } from '../transform/transform';\nimport { sourceMapSupport } from '../utilsBundle';\n\nimport type { TestRun } from './tasks';\nimport type { TestGroup } from './testGroups';\nimport type { FullConfig, Reporter, TestError } from '../../types/testReporter';\nimport type { FullProjectInternal } from '../common/config';\nimport type { FullConfigInternal } from '../common/config';\nimport type { TestCase } from '../common/test';\nimport type { Matcher, TestCaseFilter, TestFileFilter } from '../util';\nimport type { RawSourceMap } from '../utilsBundle';\n\n\nexport async function collectProjectsAndTestFiles(testRun: TestRun, doNotRunTestsOutsideProjectFilter: boolean) {\n const config = testRun.config;\n const fsCache = new Map();\n const sourceMapCache = new Map();\n const cliFileMatcher = config.cliArgs.length ? createFileMatcherFromArguments(config.cliArgs) : null;\n\n // First collect all files for the projects in the command line, don't apply any file filters.\n const allFilesForProject = new Map<FullProjectInternal, string[]>();\n const filteredProjects = filterProjects(config.projects, config.cliProjectFilter);\n for (const project of filteredProjects) {\n const files = await collectFilesForProject(project, fsCache);\n allFilesForProject.set(project, files);\n }\n\n // Filter files based on the file filters, eliminate the empty projects.\n const filesToRunByProject = new Map<FullProjectInternal, string[]>();\n for (const [project, files] of allFilesForProject) {\n const matchedFiles = files.filter(file => {\n const hasMatchingSources = sourceMapSources(file, sourceMapCache).some(source => {\n if (cliFileMatcher && !cliFileMatcher(source))\n return false;\n return true;\n });\n return hasMatchingSources;\n });\n const filteredFiles = matchedFiles.filter(Boolean) as string[];\n filesToRunByProject.set(project, filteredFiles);\n }\n\n // (Re-)add all files for dependent projects, disregard filters.\n const projectClosure = buildProjectsClosure([...filesToRunByProject.keys()]);\n for (const [project, type] of projectClosure) {\n if (type === 'dependency') {\n const treatProjectAsEmpty = doNotRunTestsOutsideProjectFilter && !filteredProjects.includes(project);\n const files = treatProjectAsEmpty ? [] : allFilesForProject.get(project) || await collectFilesForProject(project, fsCache);\n filesToRunByProject.set(project, files);\n }\n }\n\n testRun.projectFiles = filesToRunByProject;\n testRun.projectSuites = new Map();\n}\n\nexport async function loadFileSuites(testRun: TestRun, mode: 'out-of-process' | 'in-process', errors: TestError[]) {\n // Determine all files to load.\n const config = testRun.config;\n const allTestFiles = new Set<string>();\n for (const files of testRun.projectFiles.values())\n files.forEach(file => allTestFiles.add(file));\n\n // Load test files.\n const fileSuiteByFile = new Map<string, Suite>();\n const loaderHost = mode === 'out-of-process' ? new OutOfProcessLoaderHost(config) : new InProcessLoaderHost(config);\n if (await loaderHost.start(errors)) {\n for (const file of allTestFiles) {\n const fileSuite = await loaderHost.loadTestFile(file, errors);\n fileSuiteByFile.set(file, fileSuite);\n errors.push(...createDuplicateTitlesErrors(config, fileSuite));\n }\n await loaderHost.stop();\n }\n\n // Check that no test file imports another test file.\n // Loader must be stopped first, since it populates the dependency tree.\n for (const file of allTestFiles) {\n for (const dependency of dependenciesForTestFile(file)) {\n if (allTestFiles.has(dependency)) {\n const importer = path.relative(config.config.rootDir, file);\n const importee = path.relative(config.config.rootDir, dependency);\n errors.push({\n message: `Error: test file \"${importer}\" should not import test file \"${importee}\"`,\n location: { file, line: 1, column: 1 },\n });\n }\n }\n }\n\n // Collect file suites for each project.\n for (const [project, files] of testRun.projectFiles) {\n const suites = files.map(file => fileSuiteByFile.get(file)).filter(Boolean) as Suite[];\n testRun.projectSuites.set(project, suites);\n }\n}\n\nexport async function createRootSuite(testRun: TestRun, errors: TestError[], shouldFilterOnly: boolean): Promise<{ rootSuite: Suite, topLevelProjects: FullProjectInternal[] }> {\n const config = testRun.config;\n // Create root suite, where each child will be a project suite with cloned file suites inside it.\n const rootSuite = new Suite('', 'root');\n const projectSuites = new Map<FullProjectInternal, Suite>();\n const filteredProjectSuites = new Map<FullProjectInternal, Suite>();\n\n // Filter all the projects using grep, testId, file names.\n {\n // Interpret cli parameters.\n const cliFileFilters = createFileFiltersFromArguments(config.cliArgs);\n const grepMatcher = config.cliGrep ? createTitleMatcher(forceRegExp(config.cliGrep)) : () => true;\n const grepInvertMatcher = config.cliGrepInvert ? createTitleMatcher(forceRegExp(config.cliGrepInvert)) : () => false;\n const cliTitleMatcher = (title: string) => !grepInvertMatcher(title) && grepMatcher(title);\n\n // Filter file suites for all projects.\n for (const [project, fileSuites] of testRun.projectSuites) {\n const projectSuite = createProjectSuite(project, fileSuites);\n projectSuites.set(project, projectSuite);\n\n const filteredProjectSuite = filterProjectSuite(projectSuite, { cliFileFilters, cliTitleMatcher, testFilters: config.preOnlyTestFilters });\n filteredProjectSuites.set(project, filteredProjectSuite);\n }\n }\n\n if (shouldFilterOnly) {\n // Create a fake root to execute the exclusive semantics across the projects.\n const filteredRoot = new Suite('', 'root');\n for (const filteredProjectSuite of filteredProjectSuites.values())\n filteredRoot._addSuite(filteredProjectSuite);\n filterOnly(filteredRoot);\n for (const [project, filteredProjectSuite] of filteredProjectSuites) {\n if (!filteredRoot.suites.includes(filteredProjectSuite))\n filteredProjectSuites.delete(project);\n }\n }\n\n // Add post-filtered top-level projects to the root suite for sharding and 'only' processing.\n const projectClosure = buildProjectsClosure([...filteredProjectSuites.keys()], project => filteredProjectSuites.get(project)!._hasTests());\n for (const [project, type] of projectClosure) {\n if (type === 'top-level') {\n project.project.repeatEach = project.fullConfig.configCLIOverrides.repeatEach ?? project.project.repeatEach;\n rootSuite._addSuite(buildProjectSuite(project, filteredProjectSuites.get(project)!));\n }\n }\n\n // Complain about only.\n if (config.config.forbidOnly) {\n const onlyTestsAndSuites = rootSuite._getOnlyItems();\n if (onlyTestsAndSuites.length > 0) {\n const configFilePath = config.config.configFile ? path.relative(config.config.rootDir, config.config.configFile) : undefined;\n errors.push(...createForbidOnlyErrors(onlyTestsAndSuites, config.configCLIOverrides.forbidOnly, configFilePath));\n }\n }\n\n // Shard only the top-level projects.\n if (config.config.shard) {\n // Create test groups for top-level projects.\n const testGroups: TestGroup[] = [];\n for (const projectSuite of rootSuite.suites) {\n // Split beforeAll-grouped tests into \"config.shard.total\" groups when needed.\n // Later on, we'll re-split them between workers by using \"config.workers\" instead.\n for (const group of createTestGroups(projectSuite, config.config.shard.total))\n testGroups.push(group);\n }\n\n // Shard test groups.\n const testGroupsInThisShard = filterForShard(config.config.shard, testGroups);\n const testsInThisShard = new Set<TestCase>();\n for (const group of testGroupsInThisShard) {\n for (const test of group.tests)\n testsInThisShard.add(test);\n }\n\n // Update project suites, removing empty ones.\n filterTestsRemoveEmptySuites(rootSuite, test => testsInThisShard.has(test));\n }\n\n if (config.postShardTestFilters.length)\n filterTestsRemoveEmptySuites(rootSuite, test => config.postShardTestFilters.every(filter => filter(test)));\n\n const topLevelProjects = [];\n // Now prepend dependency projects without filtration.\n {\n // Filtering 'only' and sharding might have reduced the number of top-level projects.\n // Build the project closure to only include dependencies that are still needed.\n const projectClosure = new Map(buildProjectsClosure(rootSuite.suites.map(suite => suite._fullProject!)));\n\n // Clone file suites for dependency projects.\n for (const [project, level] of projectClosure.entries()) {\n if (level === 'dependency')\n rootSuite._prependSuite(buildProjectSuite(project, projectSuites.get(project)!));\n else\n topLevelProjects.push(project);\n }\n }\n\n return { rootSuite, topLevelProjects };\n}\n\nfunction createProjectSuite(project: FullProjectInternal, fileSuites: Suite[]): Suite {\n const projectSuite = new Suite(project.project.name, 'project');\n for (const fileSuite of fileSuites)\n projectSuite._addSuite(bindFileSuiteToProject(project, fileSuite));\n\n const grepMatcher = createTitleMatcher(project.project.grep);\n const grepInvertMatcher = project.project.grepInvert ? createTitleMatcher(project.project.grepInvert) : null;\n filterTestsRemoveEmptySuites(projectSuite, (test: TestCase) => {\n const grepTitle = test._grepTitleWithTags();\n if (grepInvertMatcher?.(grepTitle))\n return false;\n return grepMatcher(grepTitle);\n });\n return projectSuite;\n}\n\nfunction filterProjectSuite(projectSuite: Suite, options: { cliFileFilters: TestFileFilter[], cliTitleMatcher?: Matcher, testFilters: TestCaseFilter[] }): Suite {\n // Fast path.\n if (!options.cliFileFilters.length && !options.cliTitleMatcher && !options.testFilters.length)\n return projectSuite;\n\n const result = projectSuite._deepClone();\n if (options.cliFileFilters.length)\n filterByFocusedLine(result, options.cliFileFilters);\n filterTestsRemoveEmptySuites(result, (test: TestCase) => {\n if (!options.testFilters.every(filter => filter(test)))\n return false;\n if (options.cliTitleMatcher && !options.cliTitleMatcher(test._grepTitleWithTags()))\n return false;\n return true;\n });\n return result;\n}\n\nfunction buildProjectSuite(project: FullProjectInternal, projectSuite: Suite): Suite {\n const result = new Suite(project.project.name, 'project');\n result._fullProject = project;\n if (project.fullyParallel)\n result._parallelMode = 'parallel';\n\n for (const fileSuite of projectSuite.suites) {\n // Fast path for the repeatEach = 0.\n result._addSuite(fileSuite);\n\n for (let repeatEachIndex = 1; repeatEachIndex < project.project.repeatEach; repeatEachIndex++) {\n const clone = fileSuite._deepClone();\n applyRepeatEachIndex(project, clone, repeatEachIndex);\n result._addSuite(clone);\n }\n }\n return result;\n}\n\nfunction createForbidOnlyErrors(onlyTestsAndSuites: (TestCase | Suite)[], forbidOnlyCLIFlag: boolean | undefined, configFilePath: string | undefined): TestError[] {\n const errors: TestError[] = [];\n for (const testOrSuite of onlyTestsAndSuites) {\n // Skip root and file.\n const title = testOrSuite.titlePath().slice(2).join(' ');\n const configFilePathName = configFilePath ? `'${configFilePath}'` : 'the Playwright configuration file';\n const forbidOnlySource = forbidOnlyCLIFlag ? `'--forbid-only' CLI flag` : `'forbidOnly' option in ${configFilePathName}`;\n const error: TestError = {\n message: `Error: item focused with '.only' is not allowed due to the ${forbidOnlySource}: \"${title}\"`,\n location: testOrSuite.location!,\n };\n errors.push(error);\n }\n return errors;\n}\n\nfunction createDuplicateTitlesErrors(config: FullConfigInternal, fileSuite: Suite): TestError[] {\n const errors: TestError[] = [];\n const testsByFullTitle = new Map<string, TestCase>();\n for (const test of fileSuite.allTests()) {\n const fullTitle = test.titlePath().slice(1).join(' \u203A ');\n const existingTest = testsByFullTitle.get(fullTitle);\n if (existingTest) {\n const error: TestError = {\n message: `Error: duplicate test title \"${fullTitle}\", first declared in ${buildItemLocation(config.config.rootDir, existingTest)}`,\n location: test.location,\n };\n errors.push(error);\n }\n testsByFullTitle.set(fullTitle, test);\n }\n return errors;\n}\n\nfunction buildItemLocation(rootDir: string, testOrSuite: Suite | TestCase) {\n if (!testOrSuite.location)\n return '';\n return `${path.relative(rootDir, testOrSuite.location.file)}:${testOrSuite.location.line}`;\n}\n\nasync function requireOrImportDefaultFunction(file: string, expectConstructor: boolean) {\n let func = await requireOrImport(file);\n if (func && typeof func === 'object' && ('default' in func))\n func = func['default'];\n if (typeof func !== 'function')\n throw errorWithFile(file, `file must export a single ${expectConstructor ? 'class' : 'function'}.`);\n return func;\n}\n\nexport function loadGlobalHook(config: FullConfigInternal, file: string): Promise<(config: FullConfig) => any> {\n return requireOrImportDefaultFunction(path.resolve(config.config.rootDir, file), false);\n}\n\nexport function loadReporter(config: FullConfigInternal | null, file: string): Promise<new (arg?: any) => Reporter> {\n return requireOrImportDefaultFunction(config ? path.resolve(config.config.rootDir, file) : file, true);\n}\n\nfunction sourceMapSources(file: string, cache: Map<string, string[]>): string[] {\n let sources = [file];\n if (!file.endsWith('.js'))\n return sources;\n if (cache.has(file))\n return cache.get(file)!;\n\n try {\n const sourceMap = sourceMapSupport.retrieveSourceMap(file);\n const sourceMapData: RawSourceMap | undefined = typeof sourceMap?.map === 'string' ? JSON.parse(sourceMap.map) : sourceMap?.map;\n if (sourceMapData?.sources)\n sources = sourceMapData.sources.map(source => path.resolve(path.dirname(file), source));\n } finally {\n cache.set(file, sources);\n return sources;\n }\n}\n\nexport async function loadTestList(config: FullConfigInternal, filePath: string): Promise<TestCaseFilter> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n const lines = content.split('\\n').map(line => line.trim()).filter(line => line && !line.startsWith('#'));\n const descriptions = lines.map(line => {\n const delimiter = line.includes('\u203A') ? '\u203A' : '>';\n const tokens = line.split(delimiter).map(token => token.trim());\n let project: string | undefined;\n if (tokens[0].startsWith('[')) {\n if (!tokens[0].endsWith(']'))\n throw new Error(`Malformed test description: ${line}`);\n project = tokens[0].substring(1, tokens[0].length - 1);\n tokens.shift();\n }\n return { project, file: toPosixPath(parseLocationArg(tokens[0]).file), titlePath: tokens.slice(1) };\n });\n return (test: TestCase) => descriptions.some(d => {\n // Note: there is no root yet at the time of filtering.\n const [projectName, , ...titles] = test.titlePath();\n if (d.project !== undefined && d.project !== projectName)\n return false;\n const relativeFile = toPosixPath(path.relative(config.config.rootDir, test.location.file));\n if (relativeFile !== d.file)\n return false;\n return d.titlePath.length === titles.length && d.titlePath.every((_, index) => titles[index] === d.titlePath[index]);\n });\n } catch (e) {\n throw errorWithFile(filePath, 'Cannot read test list file: ' + e.message);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,kBAAiB;AACjB,gBAAe;AACf,mBAA4B;AAE5B,wBAA4D;AAC5D,kBAAiJ;AACjJ,0BAA6E;AAC7E,wBAAkD;AAClD,wBAA4H;AAC5H,kBAAsB;AACtB,8BAAwC;AACxC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E,IAAI,WAAS,MAAM,KAAK,CAAC;AAC9D,UAAI;AACJ,UAAI,OAAO,CAAC,EAAE,WAAW,GAAG,GAAG;AAC7B,YAAI,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG;AACzB,gBAAM,IAAI,MAAM,+BAA+B,IAAI,EAAE;AACvD,kBAAU,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EAAE,SAAS,CAAC;AACrD,eAAO,MAAM;AAAA,MACf;AACA,aAAO,EAAE,SAAS,UAAM,8BAAY,8BAAiB,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,OAAO,MAAM,CAAC,EAAE;AAAA,IACpG,CAAC;AACD,WAAO,CAAC,SAAmB,aAAa,KAAK,OAAK;AAEhD,YAAM,CAAC,aAAa,EAAE,GAAG,MAAM,IAAI,KAAK,UAAU;AAClD,UAAI,EAAE,YAAY,UAAa,EAAE,YAAY;AAC3C,eAAO;AACT,YAAM,mBAAe,0BAAY,YAAAF,QAAK,SAAS,OAAO,OAAO,SAAS,KAAK,SAAS,IAAI,CAAC;AACzF,UAAI,iBAAiB,EAAE;AACrB,eAAO;AACT,aAAO,EAAE,UAAU,WAAW,OAAO,UAAU,EAAE,UAAU,MAAM,CAAC,GAAG,UAAU,OAAO,KAAK,MAAM,EAAE,UAAU,KAAK,CAAC;AAAA,IACrH,CAAC;AAAA,EACH,SAAS,GAAG;AACV,cAAM,2BAAc,UAAU,iCAAiC,EAAE,OAAO;AAAA,EAC1E;AACF;",
6
+ "names": ["path", "projectClosure", "fs"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/loaderHost.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ProcessHost } from './processHost';\nimport { incorporateCompilationCache } from '../common/esmLoaderHost';\nimport { serializeConfig } from '../common/ipc';\nimport { PoolBuilder } from '../common/poolBuilder';\nimport { Suite } from '../common/test';\nimport { loadTestFile } from '../common/testLoader';\nimport { addToCompilationCache } from '../transform/compilationCache';\n\nimport type { TestError } from '../../types/testReporter';\nimport type { FullConfigInternal } from '../common/config';\n\n\nexport class InProcessLoaderHost {\n private _config: FullConfigInternal;\n private _poolBuilder: PoolBuilder;\n\n constructor(config: FullConfigInternal) {\n this._config = config;\n this._poolBuilder = PoolBuilder.createForLoader();\n }\n\n async start(errors: TestError[]) {\n return true;\n }\n\n async loadTestFile(file: string, testErrors: TestError[]): Promise<Suite> {\n const result = await loadTestFile(file, this._config, testErrors);\n this._poolBuilder.buildPools(result, testErrors);\n return result;\n }\n\n async stop() {\n await incorporateCompilationCache();\n }\n}\n\nexport class OutOfProcessLoaderHost {\n private _config: FullConfigInternal;\n private _processHost: ProcessHost;\n\n constructor(config: FullConfigInternal) {\n this._config = config;\n this._processHost = new ProcessHost(require.resolve('../loader/loaderMain.js'), 'loader', {});\n }\n\n async start(errors: TestError[]) {\n const startError = await this._processHost.startRunner(serializeConfig(this._config, false));\n if (startError) {\n errors.push({\n message: `Test loader process failed to start with code \"${startError.code}\" and signal \"${startError.signal}\"`,\n });\n return false;\n }\n return true;\n }\n\n async loadTestFile(file: string, testErrors: TestError[]): Promise<Suite> {\n const result = await this._processHost.sendMessage({ method: 'loadTestFile', params: { file } }) as any;\n testErrors.push(...result.testErrors);\n return Suite._deepParse(result.fileSuite);\n }\n\n async stop() {\n const result = await this._processHost.sendMessage({ method: 'getCompilationCacheFromLoader' }) as any;\n addToCompilationCache(result);\n await this._processHost.stop();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;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,aAAa,YAAY,EAAE,QAAQ,gCAAgC,CAAC;AAC9F,uDAAsB,MAAM;AAC5B,UAAM,KAAK,aAAa,KAAK;AAAA,EAC/B;AACF;",
6
+ "names": []
7
+ }
@@ -44,6 +44,7 @@ class ProcessHost extends import_events.EventEmitter {
44
44
  this._lastMessageId = 0;
45
45
  this._callbacks = /* @__PURE__ */ new Map();
46
46
  this._producedEnv = {};
47
+ this._requestHandlers = /* @__PURE__ */ new Map();
47
48
  this._runnerScript = runnerScript;
48
49
  this._processName = processName;
49
50
  this._extraEnv = env;
@@ -51,6 +52,9 @@ class ProcessHost extends import_events.EventEmitter {
51
52
  async startRunner(runnerParams, options = {}) {
52
53
  (0, import_utils.assert)(!this.process, "Internal error: starting the same process twice");
53
54
  this.process = import_child_process.default.fork(require.resolve("../common/process"), {
55
+ // Note: we pass detached:false, so that workers are in the same process group.
56
+ // This way Ctrl+C or a kill command can shutdown all workers in case they misbehave.
57
+ // Otherwise user can end up with a bunch of workers stuck in a busy loop without self-destructing.
54
58
  detached: false,
55
59
  env: {
56
60
  ...process.env,
@@ -92,6 +96,18 @@ class ProcessHost extends import_events.EventEmitter {
92
96
  } else {
93
97
  this.emit(method, params);
94
98
  }
99
+ } else if (message.method === "__request__") {
100
+ const { id, method, params } = message.params;
101
+ const handler = this._requestHandlers.get(method);
102
+ if (!handler) {
103
+ this.send({ method: "__response__", params: { id, error: { message: "Unknown method" } } });
104
+ } else {
105
+ handler(params).then((result) => {
106
+ this.send({ method: "__response__", params: { id, result } });
107
+ }).catch((error2) => {
108
+ this.send({ method: "__response__", params: { id, error: { message: error2.message } } });
109
+ });
110
+ }
95
111
  } else {
96
112
  this.emit(message.method, message.params);
97
113
  }
@@ -135,6 +151,9 @@ class ProcessHost extends import_events.EventEmitter {
135
151
  }
136
152
  async onExit() {
137
153
  }
154
+ onRequest(method, handler) {
155
+ this._requestHandlers.set(method, handler);
156
+ }
138
157
  async stop() {
139
158
  if (!this._processDidExit && !this._didSendStop) {
140
159
  this.send({ method: "__stop__" });
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/processHost.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport child_process from 'child_process';\nimport { EventEmitter } from 'events';\n\nimport { assert, timeOrigin } from 'playwright-core/lib/utils';\nimport { debug } from 'playwright-core/lib/utilsBundle';\n\nimport type { EnvProducedPayload, ProcessInitParams } from '../common/ipc';\nimport type { ProtocolResponse } from '../common/process';\n\nexport type ProcessExitData = {\n unexpectedly: boolean;\n code: number | null;\n signal: NodeJS.Signals | null;\n};\n\nexport class ProcessHost extends EventEmitter {\n private process: child_process.ChildProcess | undefined;\n private _didSendStop = false;\n private _processDidExit = false;\n private _didExitAndRanOnExit = false;\n private _runnerScript: string;\n private _lastMessageId = 0;\n private _callbacks = new Map<number, { resolve: (result: any) => void, reject: (error: Error) => void }>();\n private _processName: string;\n private _producedEnv: Record<string, string | undefined> = {};\n private _extraEnv: Record<string, string | undefined>;\n\n constructor(runnerScript: string, processName: string, env: Record<string, string | undefined>) {\n super();\n this._runnerScript = runnerScript;\n this._processName = processName;\n this._extraEnv = env;\n }\n\n async startRunner(runnerParams: any, options: { onStdOut?: (chunk: Buffer | string) => void, onStdErr?: (chunk: Buffer | string) => void } = {}): Promise<ProcessExitData | undefined> {\n assert(!this.process, 'Internal error: starting the same process twice');\n this.process = child_process.fork(require.resolve('../common/process'), {\n detached: false,\n env: {\n ...process.env,\n ...this._extraEnv,\n },\n stdio: [\n 'ignore',\n options.onStdOut ? 'pipe' : 'inherit',\n (options.onStdErr && !process.env.PW_RUNNER_DEBUG) ? 'pipe' : 'inherit',\n 'ipc',\n ],\n });\n this.process.on('exit', async (code, signal) => {\n this._processDidExit = true;\n await this.onExit();\n this._didExitAndRanOnExit = true;\n this.emit('exit', { unexpectedly: !this._didSendStop, code, signal } as ProcessExitData);\n });\n this.process.on('error', e => {}); // do not yell at a send to dead process.\n this.process.on('message', (message: any) => {\n if (debug.enabled('pw:test:protocol'))\n debug('pw:test:protocol')('\u25C0 RECV ' + JSON.stringify(message));\n if (message.method === '__env_produced__') {\n const producedEnv: EnvProducedPayload = message.params;\n this._producedEnv = Object.fromEntries(producedEnv.map(e => [e[0], e[1] ?? undefined]));\n } else if (message.method === '__dispatch__') {\n const { id, error, method, params, result } = message.params as ProtocolResponse;\n if (id && this._callbacks.has(id)) {\n const { resolve, reject } = this._callbacks.get(id)!;\n this._callbacks.delete(id);\n if (error) {\n const errorObject = new Error(error.message);\n errorObject.stack = error.stack;\n reject(errorObject);\n } else {\n resolve(result);\n }\n } else {\n this.emit(method!, params);\n }\n } else {\n this.emit(message.method!, message.params);\n }\n });\n\n if (options.onStdOut)\n this.process.stdout?.on('data', options.onStdOut);\n if (options.onStdErr)\n this.process.stderr?.on('data', options.onStdErr);\n\n const error = await new Promise<ProcessExitData | undefined>(resolve => {\n this.process!.once('exit', (code, signal) => resolve({ unexpectedly: true, code, signal }));\n this.once('ready', () => resolve(undefined));\n });\n\n if (error)\n return error;\n\n const processParams: ProcessInitParams = {\n processName: this._processName,\n timeOrigin: timeOrigin(),\n };\n\n this.send({\n method: '__init__', params: {\n processParams,\n runnerScript: this._runnerScript,\n runnerParams\n }\n });\n }\n\n sendMessage(message: { method: string, params?: any }) {\n const id = ++this._lastMessageId;\n this.send({\n method: '__dispatch__',\n params: { id, ...message }\n });\n return new Promise((resolve, reject) => {\n this._callbacks.set(id, { resolve, reject });\n });\n }\n\n protected sendMessageNoReply(message: { method: string, params?: any }) {\n this.sendMessage(message).catch(() => {});\n }\n\n protected async onExit() {\n }\n\n async stop() {\n if (!this._processDidExit && !this._didSendStop) {\n this.send({ method: '__stop__' });\n this._didSendStop = true;\n }\n if (!this._didExitAndRanOnExit)\n await new Promise(f => this.once('exit', f));\n }\n\n didSendStop() {\n return this._didSendStop;\n }\n\n producedEnv() {\n return this._producedEnv;\n }\n\n private send(message: { method: string, params?: any }) {\n if (debug.enabled('pw:test:protocol'))\n debug('pw:test:protocol')('SEND \u25BA ' + JSON.stringify(message));\n this.process?.send(message);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,2BAA0B;AAC1B,oBAA6B;AAE7B,mBAAmC;AACnC,yBAAsB;AAWf,MAAM,oBAAoB,2BAAa;AAAA,EAY5C,YAAY,cAAsB,aAAqB,KAAyC;AAC9F,UAAM;AAXR,SAAQ,eAAe;AACvB,SAAQ,kBAAkB;AAC1B,SAAQ,uBAAuB;AAE/B,SAAQ,iBAAiB;AACzB,SAAQ,aAAa,oBAAI,IAAgF;AAEzG,SAAQ,eAAmD,CAAC;AAK1D,SAAK,gBAAgB;AACrB,SAAK,eAAe;AACpB,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA,MAAM,YAAY,cAAmB,UAAwG,CAAC,GAAyC;AACrL,6BAAO,CAAC,KAAK,SAAS,iDAAiD;AACvE,SAAK,UAAU,qBAAAA,QAAc,KAAK,gBAAgB,mBAAmB,GAAG;AAAA,MACtE,UAAU;AAAA,MACV,KAAK;AAAA,QACH,GAAG,QAAQ;AAAA,QACX,GAAG,KAAK;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL;AAAA,QACA,QAAQ,WAAW,SAAS;AAAA,QAC3B,QAAQ,YAAY,CAAC,QAAQ,IAAI,kBAAmB,SAAS;AAAA,QAC9D;AAAA,MACF;AAAA,IACF,CAAC;AACD,SAAK,QAAQ,GAAG,QAAQ,OAAO,MAAM,WAAW;AAC9C,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ACtD,QAAI,yBAAM,QAAQ,kBAAkB;AAClC,oCAAM,kBAAkB,EAAE,iBAAY,KAAK,UAAU,OAAO,CAAC;AAC/D,SAAK,SAAS,KAAK,OAAO;AAAA,EAC5B;AACF;",
6
+ "names": ["child_process", "error"]
7
+ }
@@ -145,7 +145,7 @@ function buildDependentProjects(forProjects, projects) {
145
145
  return result;
146
146
  }
147
147
  async function collectFilesForProject(project, fsCache = /* @__PURE__ */ new Map()) {
148
- const extensions = /* @__PURE__ */ new Set([".js", ".ts", ".mjs", ".mts", ".cjs", ".cts", ".jsx", ".tsx", ".mjsx", ".mtsx", ".cjsx", ".ctsx"]);
148
+ const extensions = /* @__PURE__ */ new Set([".js", ".ts", ".mjs", ".mts", ".cjs", ".cts", ".jsx", ".tsx", ".mjsx", ".mtsx", ".cjsx", ".ctsx", ".md"]);
149
149
  const testFileExtension = (file) => extensions.has(import_path.default.extname(file));
150
150
  const allFiles = await cachedCollectFiles(project.project.testDir, project.respectGitIgnore, fsCache);
151
151
  const testMatch = (0, import_util2.createFileMatcher)(project.project.testMatch);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/projectUtils.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { promisify } from 'util';\n\nimport { escapeRegExp } from 'playwright-core/lib/utils';\nimport { minimatch } from 'playwright-core/lib/utilsBundle';\n\nimport { createFileMatcher } from '../util';\n\nimport type { FullConfigInternal, FullProjectInternal } from '../common/config';\n\n\nconst readFileAsync = promisify(fs.readFile);\nconst readDirAsync = promisify(fs.readdir);\n\nfunction wildcardPatternToRegExp(pattern: string): RegExp {\n return new RegExp('^' + pattern.split('*').map(escapeRegExp).join('.*') + '$', 'ig');\n}\n\nexport function filterProjects(projects: FullProjectInternal[], projectNames?: string[]): FullProjectInternal[] {\n if (!projectNames)\n return [...projects];\n\n const projectNamesToFind = new Set<string>();\n const unmatchedProjectNames = new Map<string, string>();\n const patterns = new Set<RegExp>();\n for (const name of projectNames!) {\n const lowerCaseName = name.toLocaleLowerCase();\n if (lowerCaseName.includes('*')) {\n patterns.add(wildcardPatternToRegExp(lowerCaseName));\n } else {\n projectNamesToFind.add(lowerCaseName);\n unmatchedProjectNames.set(lowerCaseName, name);\n }\n }\n\n const result = projects.filter(project => {\n const lowerCaseName = project.project.name.toLocaleLowerCase();\n if (projectNamesToFind.has(lowerCaseName)) {\n unmatchedProjectNames.delete(lowerCaseName);\n return true;\n }\n for (const regex of patterns) {\n regex.lastIndex = 0;\n if (regex.test(lowerCaseName))\n return true;\n }\n return false;\n });\n\n if (unmatchedProjectNames.size) {\n const unknownProjectNames = Array.from(unmatchedProjectNames.values()).map(n => `\"${n}\"`).join(', ');\n throw new Error(`Project(s) ${unknownProjectNames} not found. Available projects: ${projects.map(p => `\"${p.project.name}\"`).join(', ')}`);\n }\n\n if (!result.length) {\n const allProjects = projects.map(p => `\"${p.project.name}\"`).join(', ');\n throw new Error(`No projects matched. Available projects: ${allProjects}`);\n }\n\n\n return result;\n}\n\nexport function buildTeardownToSetupsMap(projects: FullProjectInternal[]): Map<FullProjectInternal, FullProjectInternal[]> {\n const result = new Map<FullProjectInternal, FullProjectInternal[]>();\n for (const project of projects) {\n if (project.teardown) {\n const setups = result.get(project.teardown) || [];\n setups.push(project);\n result.set(project.teardown, setups);\n }\n }\n return result;\n}\n\nexport function buildProjectsClosure(projects: FullProjectInternal[], hasTests?: (project: FullProjectInternal) => boolean): Map<FullProjectInternal, 'top-level' | 'dependency'> {\n const result = new Map<FullProjectInternal, 'top-level' | 'dependency'>();\n const visit = (depth: number, project: FullProjectInternal) => {\n if (depth > 100) {\n const error = new Error('Circular dependency detected between projects.');\n error.stack = '';\n throw error;\n }\n\n if (depth === 0 && hasTests && !hasTests(project))\n return;\n\n if (result.get(project) !== 'dependency')\n result.set(project, depth ? 'dependency' : 'top-level');\n\n for (const dep of project.deps)\n visit(depth + 1, dep);\n if (project.teardown)\n visit(depth + 1, project.teardown);\n };\n for (const p of projects)\n visit(0, p);\n return result;\n}\n\nexport function findTopLevelProjects(config: FullConfigInternal): FullProjectInternal[] {\n const closure = buildProjectsClosure(config.projects);\n return [...closure].filter(entry => entry[1] === 'top-level').map(entry => entry[0]);\n}\n\nexport function buildDependentProjects(forProjects: FullProjectInternal[], projects: FullProjectInternal[]): Set<FullProjectInternal> {\n const reverseDeps = new Map<FullProjectInternal, FullProjectInternal[]>(projects.map(p => ([p, []])));\n for (const project of projects) {\n for (const dep of project.deps)\n reverseDeps.get(dep)!.push(project);\n }\n const result = new Set<FullProjectInternal>();\n const visit = (depth: number, project: FullProjectInternal) => {\n if (depth > 100) {\n const error = new Error('Circular dependency detected between projects.');\n error.stack = '';\n throw error;\n }\n result.add(project);\n for (const reverseDep of reverseDeps.get(project)!)\n visit(depth + 1, reverseDep);\n if (project.teardown)\n visit(depth + 1, project.teardown);\n };\n for (const forProject of forProjects)\n visit(0, forProject);\n return result;\n}\n\nexport async function collectFilesForProject(project: FullProjectInternal, fsCache = new Map<string, string[]>()): Promise<string[]> {\n const extensions = new Set(['.js', '.ts', '.mjs', '.mts', '.cjs', '.cts', '.jsx', '.tsx', '.mjsx', '.mtsx', '.cjsx', '.ctsx']);\n const testFileExtension = (file: string) => extensions.has(path.extname(file));\n const allFiles = await cachedCollectFiles(project.project.testDir, project.respectGitIgnore, fsCache);\n const testMatch = createFileMatcher(project.project.testMatch);\n const testIgnore = createFileMatcher(project.project.testIgnore);\n const testFiles = allFiles.filter(file => {\n if (!testFileExtension(file))\n return false;\n const isTest = !testIgnore(file) && testMatch(file);\n if (!isTest)\n return false;\n return true;\n });\n return testFiles;\n}\n\nasync function cachedCollectFiles(testDir: string, respectGitIgnore: boolean, fsCache: Map<string, string[]>) {\n const key = testDir + ':' + respectGitIgnore;\n let result = fsCache.get(key);\n if (!result) {\n result = await collectFiles(testDir, respectGitIgnore);\n fsCache.set(key, result);\n }\n return result;\n}\n\nasync function collectFiles(testDir: string, respectGitIgnore: boolean): Promise<string[]> {\n if (!fs.existsSync(testDir))\n return [];\n if (!fs.statSync(testDir).isDirectory())\n return [];\n\n type Rule = {\n dir: string;\n negate: boolean;\n match: (s: string, partial?: boolean) => boolean\n };\n type IgnoreStatus = 'ignored' | 'included' | 'ignored-but-recurse';\n\n const checkIgnores = (entryPath: string, rules: Rule[], isDirectory: boolean, parentStatus: IgnoreStatus) => {\n let status = parentStatus;\n for (const rule of rules) {\n const ruleIncludes = rule.negate;\n if ((status === 'included') === ruleIncludes)\n continue;\n const relative = path.relative(rule.dir, entryPath);\n if (rule.match('/' + relative) || rule.match(relative)) {\n // Matches \"/dir/file\" or \"dir/file\"\n status = ruleIncludes ? 'included' : 'ignored';\n } else if (isDirectory && (rule.match('/' + relative + '/') || rule.match(relative + '/'))) {\n // Matches \"/dir/subdir/\" or \"dir/subdir/\" for directories.\n status = ruleIncludes ? 'included' : 'ignored';\n } else if (isDirectory && ruleIncludes && (rule.match('/' + relative, true) || rule.match(relative, true))) {\n // Matches \"/dir/donotskip/\" when \"/dir\" is excluded, but \"!/dir/donotskip/file\" is included.\n status = 'ignored-but-recurse';\n }\n }\n return status;\n };\n\n const files: string[] = [];\n\n const visit = async (dir: string, rules: Rule[], status: IgnoreStatus) => {\n const entries = await readDirAsync(dir, { withFileTypes: true });\n entries.sort((a, b) => a.name.localeCompare(b.name));\n\n if (respectGitIgnore) {\n const gitignore = entries.find(e => e.isFile() && e.name === '.gitignore');\n if (gitignore) {\n const content = await readFileAsync(path.join(dir, gitignore.name), 'utf8');\n const newRules: Rule[] = content.split(/\\r?\\n/).map(s => {\n s = s.trim();\n if (!s)\n return;\n // Use flipNegate, because we handle negation ourselves.\n const rule = new minimatch.Minimatch(s, { matchBase: true, dot: true, flipNegate: true }) as any;\n if (rule.comment)\n return;\n rule.dir = dir;\n return rule;\n }).filter(rule => !!rule);\n rules = [...rules, ...newRules];\n }\n }\n\n for (const entry of entries) {\n if (entry.name === '.' || entry.name === '..')\n continue;\n if (entry.isFile() && entry.name === '.gitignore')\n continue;\n if (entry.isDirectory() && entry.name === 'node_modules')\n continue;\n const entryPath = path.join(dir, entry.name);\n const entryStatus = checkIgnores(entryPath, rules, entry.isDirectory(), status);\n if (entry.isDirectory() && entryStatus !== 'ignored')\n await visit(entryPath, rules, entryStatus);\n else if (entry.isFile() && entryStatus === 'included')\n files.push(entryPath);\n }\n };\n await visit(testDir, [], 'included');\n return files;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,gBAAe;AACf,kBAAiB;AACjB,kBAA0B;AAE1B,mBAA6B;AAC7B,yBAA0B;AAE1B,IAAAA,eAAkC;AAKlC,MAAM,oBAAgB,uBAAU,UAAAC,QAAG,QAAQ;AAC3C,MAAM,mBAAe,uBAAU,UAAAA,QAAG,OAAO;AAEzC,SAAS,wBAAwB,SAAyB;AACxD,SAAO,IAAI,OAAO,MAAM,QAAQ,MAAM,GAAG,EAAE,IAAI,yBAAY,EAAE,KAAK,IAAI,IAAI,KAAK,IAAI;AACrF;AAEO,SAAS,eAAe,UAAiC,cAAgD;AAC9G,MAAI,CAAC;AACH,WAAO,CAAC,GAAG,QAAQ;AAErB,QAAM,qBAAqB,oBAAI,IAAY;AAC3C,QAAM,wBAAwB,oBAAI,IAAoB;AACtD,QAAM,WAAW,oBAAI,IAAY;AACjC,aAAW,QAAQ,cAAe;AAChC,UAAM,gBAAgB,KAAK,kBAAkB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IACF;AAEA,eAAW,SAAS,SAAS;AAC3B,UAAI,MAAM,SAAS,OAAO,MAAM,SAAS;AACvC;AACF,UAAI,MAAM,OAAO,KAAK,MAAM,SAAS;AACnC;AACF,UAAI,MAAM,YAAY,KAAK,MAAM,SAAS;AACxC;AACF,YAAM,YAAY,YAAAA,QAAK,KAAK,KAAK,MAAM,IAAI;AAC3C,YAAM,cAAc,aAAa,WAAW,OAAO,MAAM,YAAY,GAAG,MAAM;AAC9E,UAAI,MAAM,YAAY,KAAK,gBAAgB;AACzC,cAAM,MAAM,WAAW,OAAO,WAAW;AAAA,eAClC,MAAM,OAAO,KAAK,gBAAgB;AACzC,cAAM,KAAK,SAAS;AAAA,IACxB;AAAA,EACF;AACA,QAAM,MAAM,SAAS,CAAC,GAAG,UAAU;AACnC,SAAO;AACT;",
6
+ "names": ["import_util", "fs", "path"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/rebase.ts"],
4
+ "sourcesContent": ["/**\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from 'fs';\nimport path from 'path';\n\n\nimport { MultiMap } from 'playwright-core/lib/utils';\nimport { colors } from 'playwright-core/lib/utils';\nimport { diff } from 'playwright-core/lib/utilsBundle';\n\nimport { filterProjects } from './projectUtils';\nimport { babelParse, traverse, types } from '../transform/babelBundle';\n\nimport type { FullConfigInternal } from '../common/config';\nimport type { InternalReporter } from '../reporters/internalReporter';\nimport type { T } from '../transform/babelBundle';\nconst t: typeof T = types;\n\ntype Location = {\n file: string;\n line: number;\n column: number;\n};\n\ntype Replacement = {\n // Points to the call expression.\n location: Location;\n code: string;\n};\n\nconst suggestedRebaselines = new MultiMap<string, Replacement>();\n\nexport function addSuggestedRebaseline(location: Location, suggestedRebaseline: string) {\n suggestedRebaselines.set(location.file, { location, code: suggestedRebaseline });\n}\n\nexport function clearSuggestedRebaselines() {\n suggestedRebaselines.clear();\n}\n\nexport async function applySuggestedRebaselines(config: FullConfigInternal, reporter: InternalReporter) {\n if (config.config.updateSnapshots === 'none')\n return;\n if (!suggestedRebaselines.size)\n return;\n const [project] = filterProjects(config.projects, config.cliProjectFilter);\n if (!project)\n return;\n\n const patches: string[] = [];\n const files: string[] = [];\n const gitCache = new Map<string, string | null>();\n\n const patchFile = path.join(project.project.outputDir, 'rebaselines.patch');\n\n for (const fileName of [...suggestedRebaselines.keys()].sort()) {\n const source = await fs.promises.readFile(fileName, 'utf8');\n const lines = source.split('\\n');\n const replacements = suggestedRebaselines.get(fileName);\n const fileNode = babelParse(source, fileName, true);\n const ranges: { start: number, end: number, oldText: string, newText: string }[] = [];\n\n traverse(fileNode, {\n CallExpression: path => {\n const node = path.node;\n if (node.arguments.length < 1)\n return;\n if (!t.isMemberExpression(node.callee))\n return;\n const argument = node.arguments[0];\n if (!t.isStringLiteral(argument) && !t.isTemplateLiteral(argument))\n return;\n const prop = node.callee.property;\n if (!prop.loc || !argument.start || !argument.end)\n return;\n // Replacements are anchored by the location of the call expression.\n // However, replacement text is meant to only replace the first argument.\n for (const replacement of replacements) {\n // In Babel, rows are 1-based, columns are 0-based.\n if (prop.loc.start.line !== replacement.location.line)\n continue;\n if (prop.loc.start.column + 1 !== replacement.location.column)\n continue;\n const indent = lines[prop.loc.start.line - 1].match(/^\\s*/)![0];\n const newText = replacement.code.replace(/\\{indent\\}/g, indent);\n ranges.push({ start: argument.start, end: argument.end, oldText: source.substring(argument.start, argument.end), newText });\n // We can have multiple, hopefully equal, replacements for the same location,\n // for example when a single test runs multiple times because of projects or retries.\n // Do not apply multiple replacements for the same assertion.\n break;\n }\n }\n });\n\n ranges.sort((a, b) => b.start - a.start);\n let result = source;\n for (const range of ranges)\n result = result.substring(0, range.start) + range.newText + result.substring(range.end);\n\n const relativeName = path.relative(process.cwd(), fileName);\n files.push(relativeName);\n\n if (config.config.updateSourceMethod === 'overwrite') {\n await fs.promises.writeFile(fileName, result);\n } else if (config.config.updateSourceMethod === '3way') {\n await fs.promises.writeFile(fileName, applyPatchWithConflictMarkers(source, result));\n } else {\n const gitFolder = findGitRoot(path.dirname(fileName), gitCache);\n const relativeToGit = path.relative(gitFolder || process.cwd(), fileName);\n patches.push(createPatch(relativeToGit, source, result));\n }\n }\n\n const fileList = files.map(file => ' ' + colors.dim(file)).join('\\n');\n reporter.onStdErr(`\\nNew baselines created for:\\n\\n${fileList}\\n`);\n if (config.config.updateSourceMethod === 'patch') {\n await fs.promises.mkdir(path.dirname(patchFile), { recursive: true });\n await fs.promises.writeFile(patchFile, patches.join('\\n'));\n reporter.onStdErr(`\\n ` + colors.cyan('git apply ' + path.relative(process.cwd(), patchFile)) + '\\n');\n }\n}\n\nfunction createPatch(fileName: string, before: string, after: string) {\n const file = fileName.replace(/\\\\/g, '/');\n const text = diff.createPatch(file, before, after, undefined, undefined, { context: 3 });\n return [\n 'diff --git a/' + file + ' b/' + file,\n '--- a/' + file,\n '+++ b/' + file,\n ...text.split('\\n').slice(4)\n ].join('\\n');\n}\n\nfunction findGitRoot(dir: string, cache: Map<string, string | null>): string | null {\n const result = cache.get(dir);\n if (result !== undefined)\n return result;\n\n const gitPath = path.join(dir, '.git');\n if (fs.existsSync(gitPath) && fs.lstatSync(gitPath).isDirectory()) {\n cache.set(dir, dir);\n return dir;\n }\n\n const parentDir = path.dirname(dir);\n if (dir === parentDir) {\n cache.set(dir, null);\n return null;\n }\n\n const parentResult = findGitRoot(parentDir, cache);\n cache.set(dir, parentResult);\n return parentResult;\n}\n\nfunction applyPatchWithConflictMarkers(oldText: string, newText: string) {\n const diffResult = diff.diffLines(oldText, newText);\n\n let result = '';\n let conflict = false;\n\n diffResult.forEach(part => {\n if (part.added) {\n if (conflict) {\n result += part.value;\n result += '>>>>>>> SNAPSHOT\\n';\n conflict = false;\n } else {\n result += '<<<<<<< HEAD\\n';\n result += part.value;\n result += '=======\\n';\n conflict = true;\n }\n } else if (part.removed) {\n result += '<<<<<<< HEAD\\n';\n result += part.value;\n result += '=======\\n';\n conflict = true;\n } else {\n if (conflict) {\n result += '>>>>>>> SNAPSHOT\\n';\n conflict = false;\n }\n result += part.value;\n }\n });\n\n if (conflict)\n result += '>>>>>>> SNAPSHOT\\n';\n return result;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,gBAAe;AACf,kBAAiB;AAGjB,mBAAyB;AACzB,IAAAA,gBAAuB;AACvB,yBAAqB;AAErB,0BAA+B;AAC/B,yBAA4C;AAK5C,MAAM,IAAc;AAcpB,MAAM,uBAAuB,IAAI,sBAA8B;AAExD,SAAS,uBAAuB,UAAoB,qBAA6B;AACtF,uBAAqB,IAAI,SAAS,MAAM,EAAE,UAAU,MAAM,oBAAoB,CAAC;AACjF;AAEO,SAAS,4BAA4B;AAC1C,uBAAqB,MAAM;AAC7B;AAEA,eAAsB,0BAA0B,QAA4B,UAA4B;AACtG,MAAI,OAAO,OAAO,oBAAoB;AACpC;AACF,MAAI,CAAC,qBAAqB;AACxB;AACF,QAAM,CAAC,OAAO,QAAI,oCAAe,OAAO,UAAU,OAAO,gBAAgB;AACzE,MAAI,CAAC;AACH;AAEF,QAAM,UAAoB,CAAC;AAC3B,QAAM,QAAkB,CAAC;AACzB,QAAM,WAAW,oBAAI,IAA2B;AAEhD,QAAM,YAAY,YAAAC,QAAK,KAAK,QAAQ,QAAQ,WAAW,mBAAmB;AAE1E,aAAW,YAAY,CAAC,GAAG,qBAAqB,KAAK,CAAC,EAAE,KAAK,GAAG;AAC9D,UAAM,SAAS,MAAM,UAAAC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,IAAI,EAAE,MAAM,CAAC;AAAA,EAC7B,EAAE,KAAK,IAAI;AACb;AAEA,SAAS,YAAY,KAAa,OAAkD;AAClF,QAAM,SAAS,MAAM,IAAI,GAAG;AAC5B,MAAI,WAAW;AACb,WAAO;AAET,QAAM,UAAU,YAAAA,QAAK,KAAK,KAAK,MAAM;AACrC,MAAI,UAAAC,QAAG,WAAW,OAAO,KAAK,UAAAA,QAAG,UAAU,OAAO,EAAE,YAAY,GAAG;AACjE,UAAM,IAAI,KAAK,GAAG;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,YAAAD,QAAK,QAAQ,GAAG;AAClC,MAAI,QAAQ,WAAW;AACrB,UAAM,IAAI,KAAK,IAAI;AACnB,WAAO;AAAA,EACT;AAEA,QAAM,eAAe,YAAY,WAAW,KAAK;AACjD,QAAM,IAAI,KAAK,YAAY;AAC3B,SAAO;AACT;AAEA,SAAS,8BAA8B,SAAiB,SAAiB;AACvE,QAAM,aAAa,wBAAK,UAAU,SAAS,OAAO;AAElD,MAAI,SAAS;AACb,MAAI,WAAW;AAEf,aAAW,QAAQ,UAAQ;AACzB,QAAI,KAAK,OAAO;AACd,UAAI,UAAU;AACZ,kBAAU,KAAK;AACf,kBAAU;AACV,mBAAW;AAAA,MACb,OAAO;AACL,kBAAU;AACV,kBAAU,KAAK;AACf,kBAAU;AACV,mBAAW;AAAA,MACb;AAAA,IACF,WAAW,KAAK,SAAS;AACvB,gBAAU;AACV,gBAAU,KAAK;AACf,gBAAU;AACV,iBAAW;AAAA,IACb,OAAO;AACL,UAAI,UAAU;AACZ,kBAAU;AACV,mBAAW;AAAA,MACb;AACA,gBAAU,KAAK;AAAA,IACjB;AAAA,EACF,CAAC;AAED,MAAI;AACF,cAAU;AACZ,SAAO;AACT;",
6
+ "names": ["import_utils", "path", "fs"]
7
+ }
@@ -46,6 +46,7 @@ var import_junit = __toESM(require("../reporters/junit"));
46
46
  var import_line = __toESM(require("../reporters/line"));
47
47
  var import_list = __toESM(require("../reporters/list"));
48
48
  var import_listModeReporter = __toESM(require("../reporters/listModeReporter"));
49
+ var import_smoothdeploy = __toESM(require("../reporters/smoothdeploy"));
49
50
  var import_reporterV2 = require("../reporters/reporterV2");
50
51
  async function createReporters(config, mode, descriptions) {
51
52
  const defaultReporters = {
@@ -57,7 +58,8 @@ async function createReporters(config, mode, descriptions) {
57
58
  json: import_json.default,
58
59
  junit: import_junit.default,
59
60
  null: import_empty.default,
60
- html: import_html.default
61
+ html: import_html.default,
62
+ smoothdeploy: import_smoothdeploy.default
61
63
  };
62
64
  const reporters = [];
63
65
  descriptions ??= config.config.reporter;
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/reporters.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { calculateSha1 } from 'playwright-core/lib/utils';\n\nimport { loadReporter } from './loadUtils';\nimport { formatError } from '../reporters/base';\nimport { BlobReporter } from '../reporters/blob';\nimport DotReporter from '../reporters/dot';\nimport EmptyReporter from '../reporters/empty';\nimport GitHubReporter from '../reporters/github';\nimport HtmlReporter from '../reporters/html';\nimport JSONReporter from '../reporters/json';\nimport JUnitReporter from '../reporters/junit';\nimport LineReporter from '../reporters/line';\nimport ListReporter from '../reporters/list';\nimport ListModeReporter from '../reporters/listModeReporter';\nimport { wrapReporterAsV2 } from '../reporters/reporterV2';\n\nimport type { ReporterDescription } from '../../types/test';\nimport type { TestError } from '../../types/testReporter';\nimport type { BuiltInReporter, FullConfigInternal } from '../common/config';\nimport type { CommonReporterOptions, Screen } from '../reporters/base';\nimport type { ReporterV2 } from '../reporters/reporterV2';\n\nexport async function createReporters(config: FullConfigInternal, mode: 'list' | 'test' | 'merge', descriptions?: ReporterDescription[]): Promise<ReporterV2[]> {\n const defaultReporters: { [key in BuiltInReporter]: new(arg: any) => ReporterV2 } = {\n blob: BlobReporter,\n dot: mode === 'list' ? ListModeReporter : DotReporter,\n line: mode === 'list' ? ListModeReporter : LineReporter,\n list: mode === 'list' ? ListModeReporter : ListReporter,\n github: GitHubReporter,\n json: JSONReporter,\n junit: JUnitReporter,\n null: EmptyReporter,\n html: HtmlReporter,\n };\n const reporters: ReporterV2[] = [];\n descriptions ??= config.config.reporter;\n if (config.configCLIOverrides.additionalReporters)\n descriptions = [...descriptions, ...config.configCLIOverrides.additionalReporters];\n const runOptions = reporterOptions(config, mode);\n for (const r of descriptions) {\n const [name, arg] = r;\n const options = { ...runOptions, ...arg };\n if (name in defaultReporters) {\n reporters.push(new defaultReporters[name as keyof typeof defaultReporters](options));\n } else {\n const reporterConstructor = await loadReporter(config, name);\n reporters.push(wrapReporterAsV2(new reporterConstructor(options)));\n }\n }\n if (process.env.PW_TEST_REPORTER) {\n const reporterConstructor = await loadReporter(config, process.env.PW_TEST_REPORTER);\n reporters.push(wrapReporterAsV2(new reporterConstructor(runOptions)));\n }\n\n const someReporterPrintsToStdio = reporters.some(r => r.printsToStdio ? r.printsToStdio() : true);\n if (reporters.length && !someReporterPrintsToStdio) {\n // Add a line/dot/list-mode reporter for convenience.\n // Important to put it first, just in case some other reporter stalls onEnd.\n if (mode === 'list')\n reporters.unshift(new ListModeReporter());\n else if (mode !== 'merge')\n reporters.unshift(!process.env.CI ? new LineReporter() : new DotReporter());\n }\n return reporters;\n}\n\nexport async function createReporterForTestServer(file: string, messageSink: (message: any) => void): Promise<ReporterV2> {\n const reporterConstructor = await loadReporter(null, file);\n return wrapReporterAsV2(new reporterConstructor({\n _send: messageSink,\n }));\n}\n\ninterface ErrorCollectingReporter extends ReporterV2 {\n errors(): TestError[];\n}\n\nexport function createErrorCollectingReporter(screen: Screen): ErrorCollectingReporter {\n const errors: TestError[] = [];\n return {\n version: () => 'v2',\n onError(error: TestError) {\n errors.push(error);\n screen.stderr?.write(formatError(screen, error).message + '\\n');\n },\n errors: () => errors,\n };\n}\n\nfunction reporterOptions(config: FullConfigInternal, mode: 'list' | 'test' | 'merge'): CommonReporterOptions {\n return {\n configDir: config.configDir,\n _mode: mode,\n _commandHash: computeCommandHash(config),\n };\n}\n\nfunction computeCommandHash(config: FullConfigInternal) {\n const parts = [];\n // Include project names for readability.\n if (config.cliProjectFilter)\n parts.push(...config.cliProjectFilter);\n const command = {} as any;\n if (config.cliArgs.length)\n command.cliArgs = config.cliArgs;\n if (config.cliGrep)\n command.cliGrep = config.cliGrep;\n if (config.cliGrepInvert)\n command.cliGrepInvert = config.cliGrepInvert;\n if (config.cliOnlyChanged)\n command.cliOnlyChanged = config.cliOnlyChanged;\n if (config.config.tags.length)\n command.tags = config.config.tags.join(' ');\n if (Object.keys(command).length)\n parts.push(calculateSha1(JSON.stringify(command)).substring(0, 7));\n return parts.join('-');\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAA8B;AAE9B,uBAA6B;AAC7B,kBAA4B;AAC5B,kBAA6B;AAC7B,iBAAwB;AACxB,mBAA0B;AAC1B,oBAA2B;AAC3B,kBAAyB;AACzB,kBAAyB;AACzB,mBAA0B;AAC1B,kBAAyB;AACzB,kBAAyB;AACzB,8BAA6B;AAC7B,wBAAiC;AAQjC,eAAsB,gBAAgB,QAA4B,MAAiC,cAA6D;AAC9J,QAAM,mBAA8E;AAAA,IAClF,MAAM;AAAA,IACN,KAAK,SAAS,SAAS,wBAAAA,UAAmB,WAAAC;AAAA,IAC1C,MAAM,SAAS,SAAS,wBAAAD,UAAmB,YAAAE;AAAA,IAC3C,MAAM,SAAS,SAAS,wBAAA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AAa,MAAM,IAAI;AACzD,aAAO,oCAAiB,IAAI,oBAAoB;AAAA,IAC9C,OAAO;AAAA,EACT,CAAC,CAAC;AACJ;AAMO,SAAS,8BAA8B,QAAyC;AACrF,QAAM,SAAsB,CAAC;AAC7B,SAAO;AAAA,IACL,SAAS,MAAM;AAAA,IACf,QAAQ,OAAkB;AACxB,aAAO,KAAK,KAAK;AACjB,aAAO,QAAQ,UAAM,yBAAY,QAAQ,KAAK,EAAE,UAAU,IAAI;AAAA,IAChE;AAAA,IACA,QAAQ,MAAM;AAAA,EAChB;AACF;AAEA,SAAS,gBAAgB,QAA4B,MAAwD;AAC3G,SAAO;AAAA,IACL,WAAW,OAAO;AAAA,IAClB,OAAO;AAAA,IACP,cAAc,mBAAmB,MAAM;AAAA,EACzC;AACF;AAEA,SAAS,mBAAmB,QAA4B;AACtD,QAAM,QAAQ,CAAC;AAEf,MAAI,OAAO;AACT,UAAM,KAAK,GAAG,OAAO,gBAAgB;AACvC,QAAM,UAAU,CAAC;AACjB,MAAI,OAAO,QAAQ;AACjB,YAAQ,UAAU,OAAO;AAC3B,MAAI,OAAO;AACT,YAAQ,UAAU,OAAO;AAC3B,MAAI,OAAO;AACT,YAAQ,gBAAgB,OAAO;AACjC,MAAI,OAAO;AACT,YAAQ,iBAAiB,OAAO;AAClC,MAAI,OAAO,OAAO,KAAK;AACrB,YAAQ,OAAO,OAAO,OAAO,KAAK,KAAK,GAAG;AAC5C,MAAI,OAAO,KAAK,OAAO,EAAE;AACvB,UAAM,SAAK,4BAAc,KAAK,UAAU,OAAO,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC;AACnE,SAAO,MAAM,KAAK,GAAG;AACvB;",
6
+ "names": ["ListModeReporter", "DotReporter", "LineReporter", "ListReporter", "GitHubReporter", "JSONReporter", "JUnitReporter", "EmptyReporter", "HtmlReporter"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/sigIntWatcher.ts"],
4
+ "sourcesContent": ["/**\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class SigIntWatcher {\n private _hadSignal: boolean = false;\n private _sigintPromise: Promise<void>;\n private _sigintHandler: () => void;\n constructor() {\n let sigintCallback: () => void;\n this._sigintPromise = new Promise<void>(f => sigintCallback = f);\n this._sigintHandler = () => {\n FixedNodeSIGINTHandler.off(this._sigintHandler);\n this._hadSignal = true;\n sigintCallback();\n };\n FixedNodeSIGINTHandler.on(this._sigintHandler);\n }\n\n promise(): Promise<void> {\n return this._sigintPromise;\n }\n\n hadSignal(): boolean {\n return this._hadSignal;\n }\n\n disarm() {\n FixedNodeSIGINTHandler.off(this._sigintHandler);\n }\n}\n\n// NPM/NPX will send us duplicate SIGINT signals, so we need to ignore them.\nclass FixedNodeSIGINTHandler {\n private static _handlers: (() => void)[] = [];\n private static _ignoreNextSIGINTs = false;\n private static _handlerInstalled = false;\n\n static _dispatch = () => {\n if (this._ignoreNextSIGINTs)\n return;\n\n this._ignoreNextSIGINTs = true;\n setTimeout(() => {\n this._ignoreNextSIGINTs = false;\n // We remove the handler so that second Ctrl+C immediately kills the process\n // via the default sigint handler. This is handy in the case where our shutdown\n // takes a lot of time or is buggy.\n //\n // When running through NPM we might get multiple SIGINT signals\n // for a single Ctrl+C - this is an NPM bug present since NPM v6+.\n // https://github.com/npm/cli/issues/1591\n // https://github.com/npm/cli/issues/2124\n // https://github.com/npm/cli/issues/5021\n //\n // Therefore, removing the handler too soon will just kill the process\n // with default handler without printing the results.\n // We work around this by giving NPM 1000ms to send us duplicate signals.\n // The side effect is that slow shutdown or bug in our process will force\n // the user to hit Ctrl+C again after at least a second.\n if (!this._handlers.length)\n this._uninstall();\n }, 1000);\n for (const handler of this._handlers)\n handler();\n };\n\n static _install() {\n if (!this._handlerInstalled) {\n this._handlerInstalled = true;\n process.on('SIGINT', this._dispatch);\n }\n }\n\n static _uninstall() {\n if (this._handlerInstalled) {\n this._handlerInstalled = false;\n process.off('SIGINT', this._dispatch);\n }\n }\n\n static on(handler: () => void) {\n this._handlers.push(handler);\n if (this._handlers.length === 1)\n this._install();\n }\n\n static off(handler: () => void) {\n this._handlers = this._handlers.filter(h => h !== handler);\n if (!this._ignoreNextSIGINTs && !this._handlers.length)\n this._uninstall();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,MAAM,cAAc;AAAA,EAIzB,cAAc;AAHd,SAAQ,aAAsB;AAI5B,QAAI;AACJ,SAAK,iBAAiB,IAAI,QAAc,OAAK,iBAAiB,CAAC;AAC/D,SAAK,iBAAiB,MAAM;AAC1B,6BAAuB,IAAI,KAAK,cAAc;AAC9C,WAAK,aAAa;AAClB,qBAAe;AAAA,IACjB;AACA,2BAAuB,GAAG,KAAK,cAAc;AAAA,EAC/C;AAAA,EAEA,UAAyB;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAqB;AACnB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,SAAS;AACP,2BAAuB,IAAI,KAAK,cAAc;AAAA,EAChD;AACF;AAGA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,SAAe,YAA4B,CAAC;AAAA;AAAA,EAC5C;AAAA,SAAe,qBAAqB;AAAA;AAAA,EACpC;AAAA,SAAe,oBAAoB;AAAA;AAAA,EAEnC;AAAA,SAAO,YAAY,MAAM;AACvB,UAAI,KAAK;AACP;AAEF,WAAK,qBAAqB;AAC1B,iBAAW,MAAM;AACf,aAAK,qBAAqB;AAgB1B,YAAI,CAAC,KAAK,UAAU;AAClB,eAAK,WAAW;AAAA,MACpB,GAAG,GAAI;AACP,iBAAW,WAAW,KAAK;AACzB,gBAAQ;AAAA,IACZ;AAAA;AAAA,EAEA,OAAO,WAAW;AAChB,QAAI,CAAC,KAAK,mBAAmB;AAC3B,WAAK,oBAAoB;AACzB,cAAQ,GAAG,UAAU,KAAK,SAAS;AAAA,IACrC;AAAA,EACF;AAAA,EAEA,OAAO,aAAa;AAClB,QAAI,KAAK,mBAAmB;AAC1B,WAAK,oBAAoB;AACzB,cAAQ,IAAI,UAAU,KAAK,SAAS;AAAA,IACtC;AAAA,EACF;AAAA,EAEA,OAAO,GAAG,SAAqB;AAC7B,SAAK,UAAU,KAAK,OAAO;AAC3B,QAAI,KAAK,UAAU,WAAW;AAC5B,WAAK,SAAS;AAAA,EAClB;AAAA,EAEA,OAAO,IAAI,SAAqB;AAC9B,SAAK,YAAY,KAAK,UAAU,OAAO,OAAK,MAAM,OAAO;AACzD,QAAI,CAAC,KAAK,sBAAsB,CAAC,KAAK,UAAU;AAC9C,WAAK,WAAW;AAAA,EACpB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var storage_exports = {};
30
+ __export(storage_exports, {
31
+ Storage: () => Storage
32
+ });
33
+ module.exports = __toCommonJS(storage_exports);
34
+ var import_fs = __toESM(require("fs"));
35
+ var import_path = __toESM(require("path"));
36
+ var import_utils = require("playwright-core/lib/utils");
37
+ class Storage {
38
+ static {
39
+ this._storages = /* @__PURE__ */ new Map();
40
+ }
41
+ static {
42
+ this._serializeQueue = Promise.resolve();
43
+ }
44
+ static clone(storageFile, outputDir) {
45
+ return Storage._withStorage(storageFile, (storage) => storage._clone(outputDir));
46
+ }
47
+ static upstream(storageFile, storageOutFile) {
48
+ return Storage._withStorage(storageFile, (storage) => storage._upstream(storageOutFile));
49
+ }
50
+ static _withStorage(fileName, runnable) {
51
+ this._serializeQueue = this._serializeQueue.then(() => {
52
+ let storage = Storage._storages.get(fileName);
53
+ if (!storage) {
54
+ storage = new Storage(fileName);
55
+ Storage._storages.set(fileName, storage);
56
+ }
57
+ return runnable(storage);
58
+ });
59
+ return this._serializeQueue;
60
+ }
61
+ constructor(fileName) {
62
+ this._fileName = fileName;
63
+ }
64
+ async _clone(outputDir) {
65
+ const entries = await this._load();
66
+ if (this._lastSnapshotFileName)
67
+ return this._lastSnapshotFileName;
68
+ const snapshotFile = import_path.default.join(outputDir, `pw-storage-${(0, import_utils.createGuid)()}.json`);
69
+ await import_fs.default.promises.writeFile(snapshotFile, JSON.stringify(entries, null, 2)).catch(() => {
70
+ });
71
+ this._lastSnapshotFileName = snapshotFile;
72
+ return snapshotFile;
73
+ }
74
+ async _upstream(storageOutFile) {
75
+ const entries = await this._load();
76
+ const newEntries = await import_fs.default.promises.readFile(storageOutFile, "utf8").then(JSON.parse).catch(() => ({}));
77
+ for (const [key, newValue] of Object.entries(newEntries))
78
+ entries[key] = newValue;
79
+ this._lastSnapshotFileName = void 0;
80
+ await import_fs.default.promises.writeFile(this._fileName, JSON.stringify(entries, null, 2));
81
+ }
82
+ async _load() {
83
+ if (!this._entriesPromise)
84
+ this._entriesPromise = import_fs.default.promises.readFile(this._fileName, "utf8").then(JSON.parse).catch(() => ({}));
85
+ return this._entriesPromise;
86
+ }
87
+ }
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ Storage
91
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/taskRunner.ts"],
4
+ "sourcesContent": ["/**\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ManualPromise, monotonicTime } from 'playwright-core/lib/utils';\nimport { colors } from 'playwright-core/lib/utils';\nimport { debug } from 'playwright-core/lib/utilsBundle';\n\n\nimport { SigIntWatcher } from './sigIntWatcher';\nimport { serializeError } from '../util';\n\nimport type { FullResult, TestError } from '../../types/testReporter';\nimport type { InternalReporter } from '../reporters/internalReporter';\n\ntype TaskPhase<Context> = (context: Context, errors: TestError[], softErrors: TestError[]) => Promise<void> | void;\nexport type Task<Context> = { title: string, setup?: TaskPhase<Context>, teardown?: TaskPhase<Context> };\n\nexport class TaskRunner<Context> {\n private _tasks: Task<Context>[] = [];\n private _reporter: InternalReporter;\n private _hasErrors = false;\n private _interrupted = false;\n private _isTearDown = false;\n private _globalTimeoutForError: number;\n\n constructor(reporter: InternalReporter, globalTimeoutForError: number) {\n this._reporter = reporter;\n this._globalTimeoutForError = globalTimeoutForError;\n }\n\n addTask(task: Task<Context>) {\n this._tasks.push(task);\n }\n\n async run(context: Context, deadline: number, cancelPromise?: ManualPromise<void>): Promise<FullResult['status']> {\n const { status, cleanup } = await this.runDeferCleanup(context, deadline, cancelPromise);\n const teardownStatus = await cleanup();\n return status === 'passed' ? teardownStatus : status;\n }\n\n async runDeferCleanup(context: Context, deadline: number, cancelPromise = new ManualPromise<void>()): Promise<{ status: FullResult['status'], cleanup: () => Promise<FullResult['status']> }> {\n const sigintWatcher = new SigIntWatcher();\n const timeoutWatcher = new TimeoutWatcher(deadline);\n const teardownRunner = new TaskRunner<Context>(this._reporter, this._globalTimeoutForError);\n teardownRunner._isTearDown = true;\n\n let currentTaskName: string | undefined;\n\n const taskLoop = async () => {\n for (const task of this._tasks) {\n currentTaskName = task.title;\n if (this._interrupted)\n break;\n debug('pw:test:task')(`\"${task.title}\" started`);\n const errors: TestError[] = [];\n const softErrors: TestError[] = [];\n try {\n teardownRunner._tasks.unshift({ title: `teardown for ${task.title}`, setup: task.teardown });\n await task.setup?.(context, errors, softErrors);\n } catch (e) {\n debug('pw:test:task')(`error in \"${task.title}\": `, e);\n errors.push(serializeError(e));\n } finally {\n for (const error of [...softErrors, ...errors])\n this._reporter.onError?.(error);\n if (errors.length) {\n if (!this._isTearDown)\n this._interrupted = true;\n this._hasErrors = true;\n }\n }\n debug('pw:test:task')(`\"${task.title}\" finished`);\n }\n };\n\n await Promise.race([\n taskLoop(),\n cancelPromise,\n sigintWatcher.promise(),\n timeoutWatcher.promise,\n ]);\n\n sigintWatcher.disarm();\n timeoutWatcher.disarm();\n\n // Prevent subsequent tasks from running.\n this._interrupted = true;\n\n let status: FullResult['status'] = 'passed';\n if (sigintWatcher.hadSignal() || cancelPromise?.isDone()) {\n status = 'interrupted';\n } else if (timeoutWatcher.timedOut()) {\n this._reporter.onError?.({ message: colors.red(`Timed out waiting ${this._globalTimeoutForError / 1000}s for the ${currentTaskName} to run`) });\n status = 'timedout';\n } else if (this._hasErrors) {\n status = 'failed';\n }\n cancelPromise?.resolve();\n // Note that upon hitting deadline, we \"run cleanup\", but it exits immediately\n // because of the same deadline. Essentially, we're not performing any cleanup.\n const cleanup = () => teardownRunner.runDeferCleanup(context, deadline).then(r => r.status);\n return { status, cleanup };\n }\n}\n\nclass TimeoutWatcher {\n private _timedOut = false;\n readonly promise = new ManualPromise();\n private _timer: NodeJS.Timeout | undefined;\n\n constructor(deadline: number) {\n if (!deadline)\n return;\n\n if (deadline - monotonicTime() <= 0) {\n this._timedOut = true;\n this.promise.resolve();\n return;\n }\n this._timer = setTimeout(() => {\n this._timedOut = true;\n this.promise.resolve();\n }, deadline - monotonicTime());\n }\n\n timedOut(): boolean {\n return this._timedOut;\n }\n\n disarm() {\n clearTimeout(this._timer);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAA6C;AAC7C,IAAAA,gBAAuB;AACvB,yBAAsB;AAGtB,2BAA8B;AAC9B,kBAA+B;AAQxB,MAAM,WAAoB;AAAA,EAQ/B,YAAY,UAA4B,uBAA+B;AAPvE,SAAQ,SAA0B,CAAC;AAEnC,SAAQ,aAAa;AACrB,SAAQ,eAAe;AACvB,SAAQ,cAAc;AAIpB,SAAK,YAAY;AACjB,SAAK,yBAAyB;AAAA,EAChC;AAAA,EAEA,QAAQ,MAAqB;AAC3B,SAAK,OAAO,KAAK,IAAI;AAAA,EACvB;AAAA,EAEA,MAAM,IAAI,SAAkB,UAAkB,eAAoE;AAChH,UAAM,EAAE,QAAQ,QAAQ,IAAI,MAAM,KAAK,gBAAgB,SAAS,UAAU,aAAa;AACvF,UAAM,iBAAiB,MAAM,QAAQ;AACrC,WAAO,WAAW,WAAW,iBAAiB;AAAA,EAChD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ACxD,eAAS;AAAA,IACX,WAAW,eAAe,SAAS,GAAG;AACpC,WAAK,UAAU,UAAU,EAAE,SAAS,qBAAO,IAAI,qBAAqB,KAAK,yBAAyB,GAAI,aAAa,eAAe,SAAS,EAAE,CAAC;AAC9I,eAAS;AAAA,IACX,WAAW,KAAK,YAAY;AAC1B,eAAS;AAAA,IACX;AACA,mBAAe,QAAQ;AAGvB,UAAM,UAAU,MAAM,eAAe,gBAAgB,SAAS,QAAQ,EAAE,KAAK,OAAK,EAAE,MAAM;AAC1F,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AACF;AAEA,MAAM,eAAe;AAAA,EAKnB,YAAY,UAAkB;AAJ9B,SAAQ,YAAY;AACpB,SAAS,UAAU,IAAI,2BAAc;AAInC,QAAI,CAAC;AACH;AAEF,QAAI,eAAW,4BAAc,KAAK,GAAG;AACnC,WAAK,YAAY;AACjB,WAAK,QAAQ,QAAQ;AACrB;AAAA,IACF;AACA,SAAK,SAAS,WAAW,MAAM;AAC7B,WAAK,YAAY;AACjB,WAAK,QAAQ,QAAQ;AAAA,IACvB,GAAG,eAAW,4BAAc,CAAC;AAAA,EAC/B;AAAA,EAEA,WAAoB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,SAAS;AACP,iBAAa,KAAK,MAAM;AAAA,EAC1B;AACF;",
6
+ "names": ["import_utils"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/tasks.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { promisify } from 'util';\n\nimport { monotonicTime, removeFolders } from 'playwright-core/lib/utils';\nimport { debug } from 'playwright-core/lib/utilsBundle';\n\nimport { Dispatcher } from './dispatcher';\nimport { FailureTracker } from './failureTracker';\nimport { collectProjectsAndTestFiles, createRootSuite, loadFileSuites, loadGlobalHook, loadTestList } from './loadUtils';\nimport { buildDependentProjects, buildTeardownToSetupsMap, filterProjects } from './projectUtils';\nimport { applySuggestedRebaselines, clearSuggestedRebaselines } from './rebase';\nimport { TaskRunner } from './taskRunner';\nimport { detectChangedTestFiles } from './vcs';\nimport { Suite } from '../common/test';\nimport { createTestGroups } from '../runner/testGroups';\nimport { cacheDir } from '../transform/compilationCache';\nimport { removeDirAndLogToConsole } from '../util';\n\nimport type { TestGroup } from '../runner/testGroups';\nimport type { EnvByProjectId } from './dispatcher';\nimport type { TestRunnerPluginRegistration } from '../plugins';\nimport type { Task } from './taskRunner';\nimport type { FullResult } from '../../types/testReporter';\nimport type { FullConfigInternal, FullProjectInternal } from '../common/config';\nimport type { InternalReporter } from '../reporters/internalReporter';\nimport type { ManualPromise } from 'playwright-core/lib/utils';\n\nconst readDirAsync = promisify(fs.readdir);\n\ntype ProjectWithTestGroups = {\n project: FullProjectInternal;\n projectSuite: Suite;\n testGroups: TestGroup[];\n};\n\ntype Phase = {\n dispatcher: Dispatcher,\n projects: ProjectWithTestGroups[]\n};\n\nexport class TestRun {\n readonly config: FullConfigInternal;\n readonly reporter: InternalReporter;\n readonly failureTracker: FailureTracker;\n rootSuite: Suite | undefined = undefined;\n readonly phases: Phase[] = [];\n projectFiles: Map<FullProjectInternal, string[]> = new Map();\n projectSuites: Map<FullProjectInternal, Suite[]> = new Map();\n topLevelProjects: FullProjectInternal[] = [];\n\n constructor(config: FullConfigInternal, reporter: InternalReporter, options?: { pauseOnError?: boolean, pauseAtEnd?: boolean }) {\n this.config = config;\n this.reporter = reporter;\n this.failureTracker = new FailureTracker(config, options);\n }\n}\n\nexport async function runTasks(testRun: TestRun, tasks: Task<TestRun>[], globalTimeout?: number, cancelPromise?: ManualPromise<void>) {\n const deadline = globalTimeout ? monotonicTime() + globalTimeout : 0;\n const taskRunner = new TaskRunner<TestRun>(testRun.reporter, globalTimeout || 0);\n for (const task of tasks)\n taskRunner.addTask(task);\n testRun.reporter.onConfigure(testRun.config.config);\n const status = await taskRunner.run(testRun, deadline, cancelPromise);\n return await finishTaskRun(testRun, status);\n}\n\nexport async function runTasksDeferCleanup(testRun: TestRun, tasks: Task<TestRun>[]) {\n const taskRunner = new TaskRunner<TestRun>(testRun.reporter, 0);\n for (const task of tasks)\n taskRunner.addTask(task);\n testRun.reporter.onConfigure(testRun.config.config);\n const { status, cleanup } = await taskRunner.runDeferCleanup(testRun, 0);\n return { status: await finishTaskRun(testRun, status), cleanup };\n}\n\nasync function finishTaskRun(testRun: TestRun, status: FullResult['status']) {\n if (status === 'passed')\n status = testRun.failureTracker.result();\n const modifiedResult = await testRun.reporter.onEnd({ status });\n if (modifiedResult && modifiedResult.status)\n status = modifiedResult.status;\n await testRun.reporter.onExit();\n return status;\n}\n\nexport function createGlobalSetupTasks(config: FullConfigInternal) {\n const tasks: Task<TestRun>[] = [];\n if (!config.configCLIOverrides.preserveOutputDir)\n tasks.push(createRemoveOutputDirsTask());\n tasks.push(\n ...createPluginSetupTasks(config),\n ...config.globalTeardowns.map(file => createGlobalTeardownTask(file, config)).reverse(),\n ...config.globalSetups.map(file => createGlobalSetupTask(file, config)),\n );\n return tasks;\n}\n\nexport function createRunTestsTasks(config: FullConfigInternal) {\n return [\n createPhasesTask(),\n createReportBeginTask(),\n ...config.plugins.map(plugin => createPluginBeginTask(plugin)),\n createRunTestsTask(),\n ];\n}\n\nexport function createClearCacheTask(config: FullConfigInternal): Task<TestRun> {\n return {\n title: 'clear cache',\n setup: async () => {\n await removeDirAndLogToConsole(cacheDir);\n for (const plugin of config.plugins)\n await plugin.instance?.clearCache?.();\n },\n };\n}\n\nexport function createReportBeginTask(): Task<TestRun> {\n return {\n title: 'report begin',\n setup: async testRun => {\n testRun.reporter.onBegin?.(testRun.rootSuite!);\n },\n teardown: async ({}) => {},\n };\n}\n\nexport function createPluginSetupTasks(config: FullConfigInternal): Task<TestRun>[] {\n return config.plugins.map(plugin => ({\n title: 'plugin setup',\n setup: async ({ reporter }) => {\n if (typeof plugin.factory === 'function')\n plugin.instance = await plugin.factory();\n else\n plugin.instance = plugin.factory;\n await plugin.instance?.setup?.(config.config, config.configDir, reporter);\n },\n teardown: async () => {\n await plugin.instance?.teardown?.();\n },\n }));\n}\n\nfunction createPluginBeginTask(plugin: TestRunnerPluginRegistration): Task<TestRun> {\n return {\n title: 'plugin begin',\n setup: async testRun => {\n await plugin.instance?.begin?.(testRun.rootSuite!);\n },\n teardown: async () => {\n await plugin.instance?.end?.();\n },\n };\n}\n\nfunction createGlobalSetupTask(file: string, config: FullConfigInternal): Task<TestRun> {\n let title = 'global setup';\n if (config.globalSetups.length > 1)\n title += ` (${file})`;\n\n let globalSetupResult: any;\n return {\n title,\n setup: async ({ config }) => {\n const setupHook = await loadGlobalHook(config, file);\n globalSetupResult = await setupHook(config.config);\n },\n teardown: async () => {\n if (typeof globalSetupResult === 'function')\n await globalSetupResult();\n },\n };\n}\n\nfunction createGlobalTeardownTask(file: string, config: FullConfigInternal): Task<TestRun> {\n let title = 'global teardown';\n if (config.globalTeardowns.length > 1)\n title += ` (${file})`;\n\n return {\n title,\n teardown: async ({ config }) => {\n const teardownHook = await loadGlobalHook(config, file);\n await teardownHook(config.config);\n },\n };\n}\n\nfunction createRemoveOutputDirsTask(): Task<TestRun> {\n return {\n title: 'clear output',\n setup: async ({ config }) => {\n const outputDirs = new Set<string>();\n const projects = filterProjects(config.projects, config.cliProjectFilter);\n projects.forEach(p => outputDirs.add(p.project.outputDir));\n\n await Promise.all(Array.from(outputDirs).map(outputDir => removeFolders([outputDir]).then(async ([error]) => {\n if (!error)\n return;\n if ((error as any).code === 'EBUSY') {\n // We failed to remove folder, might be due to the whole folder being mounted inside a container:\n // https://github.com/microsoft/playwright/issues/12106\n // Do a best-effort to remove all files inside of it instead.\n const entries = await readDirAsync(outputDir).catch(e => []);\n await Promise.all(entries.map(entry => removeFolders([path.join(outputDir, entry)])));\n } else {\n throw error;\n }\n })));\n },\n };\n}\n\nexport function createListFilesTask(): Task<TestRun> {\n return {\n title: 'load tests',\n setup: async (testRun, errors) => {\n const { rootSuite, topLevelProjects } = await createRootSuite(testRun, errors, false);\n testRun.rootSuite = rootSuite;\n testRun.failureTracker.onRootSuite(rootSuite, topLevelProjects);\n await collectProjectsAndTestFiles(testRun, false);\n for (const [project, files] of testRun.projectFiles) {\n const projectSuite = new Suite(project.project.name, 'project');\n projectSuite._fullProject = project;\n testRun.rootSuite._addSuite(projectSuite);\n const suites = files.map(file => {\n const title = path.relative(testRun.config.config.rootDir, file);\n const suite = new Suite(title, 'file');\n suite.location = { file, line: 0, column: 0 };\n projectSuite._addSuite(suite);\n return suite;\n });\n testRun.projectSuites.set(project, suites);\n }\n },\n };\n}\n\nexport function createLoadTask(mode: 'out-of-process' | 'in-process', options: { filterOnly: boolean, failOnLoadErrors: boolean, doNotRunDepsOutsideProjectFilter?: boolean, populateDependencies?: boolean }): Task<TestRun> {\n return {\n title: 'load tests',\n setup: async (testRun, errors, softErrors) => {\n await collectProjectsAndTestFiles(testRun, !!options.doNotRunDepsOutsideProjectFilter);\n await loadFileSuites(testRun, mode, options.failOnLoadErrors ? errors : softErrors);\n\n if (testRun.config.cliOnlyChanged || options.populateDependencies) {\n for (const plugin of testRun.config.plugins)\n await plugin.instance?.populateDependencies?.();\n }\n\n if (testRun.config.cliOnlyChanged) {\n const changedFiles = await detectChangedTestFiles(testRun.config.cliOnlyChanged, testRun.config.configDir);\n testRun.config.preOnlyTestFilters.push(test => changedFiles.has(test.location.file));\n }\n\n if (testRun.config.cliTestList) {\n const testListFilter = await loadTestList(testRun.config, testRun.config.cliTestList);\n testRun.config.preOnlyTestFilters.push(testListFilter);\n }\n\n if (testRun.config.cliTestListInvert) {\n const testListInvertFilter = await loadTestList(testRun.config, testRun.config.cliTestListInvert);\n testRun.config.preOnlyTestFilters.push(test => !testListInvertFilter(test));\n }\n\n const { rootSuite, topLevelProjects } = await createRootSuite(testRun, options.failOnLoadErrors ? errors : softErrors, !!options.filterOnly);\n testRun.rootSuite = rootSuite;\n testRun.failureTracker.onRootSuite(rootSuite, topLevelProjects);\n // Fail when no tests.\n if (options.failOnLoadErrors && !testRun.rootSuite.allTests().length\n && !testRun.config.cliPassWithNoTests\n && !testRun.config.config.shard && !testRun.config.cliOnlyChanged\n && !testRun.config.cliTestList && !testRun.config.cliTestListInvert) {\n if (testRun.config.cliArgs.length) {\n throw new Error([\n `No tests found.`,\n `Make sure that arguments are regular expressions matching test files.`,\n `You may need to escape symbols like \"$\" or \"*\" and quote the arguments.`,\n ].join('\\n'));\n }\n throw new Error(`No tests found`);\n }\n },\n };\n}\n\nexport function createApplyRebaselinesTask(): Task<TestRun> {\n return {\n title: 'apply rebaselines',\n setup: async () => {\n clearSuggestedRebaselines();\n },\n teardown: async ({ config, reporter }) => {\n await applySuggestedRebaselines(config, reporter);\n },\n };\n}\n\nfunction createPhasesTask(): Task<TestRun> {\n return {\n title: 'create phases',\n setup: async testRun => {\n let maxConcurrentTestGroups = 0;\n\n const processed = new Set<FullProjectInternal>();\n const projectToSuite = new Map(testRun.rootSuite!.suites.map(suite => [suite._fullProject!, suite]));\n const allProjects = [...projectToSuite.keys()];\n const teardownToSetups = buildTeardownToSetupsMap(allProjects);\n const teardownToSetupsDependents = new Map<FullProjectInternal, FullProjectInternal[]>();\n for (const [teardown, setups] of teardownToSetups) {\n const closure = buildDependentProjects(setups, allProjects);\n closure.delete(teardown);\n teardownToSetupsDependents.set(teardown, [...closure]);\n }\n\n for (let i = 0; i < projectToSuite.size; i++) {\n // Find all projects that have all their dependencies processed by previous phases.\n const phaseProjects: FullProjectInternal[] = [];\n for (const project of projectToSuite.keys()) {\n if (processed.has(project))\n continue;\n const projectsThatShouldFinishFirst = [...project.deps, ...(teardownToSetupsDependents.get(project) || [])];\n if (projectsThatShouldFinishFirst.find(p => !processed.has(p)))\n continue;\n phaseProjects.push(project);\n }\n\n // Create a new phase.\n for (const project of phaseProjects)\n processed.add(project);\n if (phaseProjects.length) {\n let testGroupsInPhase = 0;\n const phase: Phase = { dispatcher: new Dispatcher(testRun.config, testRun.reporter, testRun.failureTracker), projects: [] };\n testRun.phases.push(phase);\n for (const project of phaseProjects) {\n const projectSuite = projectToSuite.get(project)!;\n const testGroups = createTestGroups(projectSuite, testRun.config.config.workers);\n phase.projects.push({ project, projectSuite, testGroups });\n testGroupsInPhase += Math.min(project.workers ?? Number.MAX_SAFE_INTEGER, testGroups.length);\n }\n debug('pw:test:task')(`created phase #${testRun.phases.length} with ${phase.projects.map(p => p.project.project.name).sort()} projects, ${testGroupsInPhase} testGroups`);\n maxConcurrentTestGroups = Math.max(maxConcurrentTestGroups, testGroupsInPhase);\n }\n }\n\n testRun.config.config.metadata.actualWorkers = Math.min(testRun.config.config.workers, maxConcurrentTestGroups);\n },\n };\n}\n\nfunction createRunTestsTask(): Task<TestRun> {\n return {\n title: 'test suite',\n setup: async ({ phases, failureTracker }) => {\n const successfulProjects = new Set<FullProjectInternal>();\n const extraEnvByProjectId: EnvByProjectId = new Map();\n const teardownToSetups = buildTeardownToSetupsMap(phases.map(phase => phase.projects.map(p => p.project)).flat());\n\n for (const { dispatcher, projects } of phases) {\n // Each phase contains dispatcher and a set of test groups.\n // We don't want to run the test groups belonging to the projects\n // that depend on the projects that failed previously.\n const phaseTestGroups: TestGroup[] = [];\n for (const { project, testGroups } of projects) {\n // Inherit extra environment variables from dependencies.\n let extraEnv: Record<string, string | undefined> = {};\n for (const dep of project.deps)\n extraEnv = { ...extraEnv, ...extraEnvByProjectId.get(dep.id) };\n for (const setup of teardownToSetups.get(project) || [])\n extraEnv = { ...extraEnv, ...extraEnvByProjectId.get(setup.id) };\n extraEnvByProjectId.set(project.id, extraEnv);\n\n const hasFailedDeps = project.deps.some(p => !successfulProjects.has(p));\n if (!hasFailedDeps)\n phaseTestGroups.push(...testGroups);\n }\n\n if (phaseTestGroups.length) {\n await dispatcher!.run(phaseTestGroups, extraEnvByProjectId);\n await dispatcher.stop();\n for (const [projectId, envProduced] of dispatcher.producedEnvByProjectId()) {\n const extraEnv = extraEnvByProjectId.get(projectId) || {};\n extraEnvByProjectId.set(projectId, { ...extraEnv, ...envProduced });\n }\n }\n\n // If the worker broke, fail everything, we have no way of knowing which\n // projects failed.\n if (!failureTracker.hasWorkerErrors()) {\n for (const { project, projectSuite } of projects) {\n const hasFailedDeps = project.deps.some(p => !successfulProjects.has(p));\n if (!hasFailedDeps && !projectSuite.allTests().some(test => !test.ok()))\n successfulProjects.add(project);\n }\n }\n }\n },\n teardown: async ({ phases }) => {\n for (const { dispatcher } of phases.reverse())\n await dispatcher.stop();\n },\n };\n}\n\nexport function createStartDevServerTask(): Task<TestRun> {\n return {\n title: 'start dev server',\n setup: async ({ config }, errors, softErrors) => {\n if (config.plugins.some(plugin => !!plugin.devServerCleanup)) {\n errors.push({ message: `DevServer is already running` });\n return;\n }\n for (const plugin of config.plugins)\n plugin.devServerCleanup = await plugin.instance?.startDevServer?.();\n if (!config.plugins.some(plugin => !!plugin.devServerCleanup))\n errors.push({ message: `DevServer is not available in the package you are using. Did you mean to use component testing?` });\n },\n\n teardown: async ({ config }) => {\n for (const plugin of config.plugins) {\n await plugin.devServerCleanup?.();\n plugin.devServerCleanup = undefined;\n }\n },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,gBAAe;AACf,kBAAiB;AACjB,kBAA0B;AAE1B,mBAA6C;AAC7C,yBAAsB;AAEtB,wBAA4B;AAC5B,4BAA+B;AAC/B,uBAA2G;AA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AU,OAAO,EAAE,OAAO,MAAM;AAC9B,iBAAW,EAAE,WAAW,KAAK,OAAO,QAAQ;AAC1C,cAAM,WAAW,KAAK;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,SAAS,2BAA0C;AACxD,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,OAAO,EAAE,OAAO,GAAG,QAAQ,eAAe;AAC/C,UAAI,OAAO,QAAQ,KAAK,YAAU,CAAC,CAAC,OAAO,gBAAgB,GAAG;AAC5D,eAAO,KAAK,EAAE,SAAS,+BAA+B,CAAC;AACvD;AAAA,MACF;AACA,iBAAW,UAAU,OAAO;AAC1B,eAAO,mBAAmB,MAAM,OAAO,UAAU,iBAAiB;AACpE,UAAI,CAAC,OAAO,QAAQ,KAAK,YAAU,CAAC,CAAC,OAAO,gBAAgB;AAC1D,eAAO,KAAK,EAAE,SAAS,kGAAkG,CAAC;AAAA,IAC9H;AAAA,IAEA,UAAU,OAAO,EAAE,OAAO,MAAM;AAC9B,iBAAW,UAAU,OAAO,SAAS;AACnC,cAAM,OAAO,mBAAmB;AAChC,eAAO,mBAAmB;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": ["import_util", "fs", "config", "path"]
7
+ }
@@ -92,15 +92,23 @@ function createTestGroups(projectSuite, expectedParallelism) {
92
92
  }
93
93
  return result;
94
94
  }
95
- function filterForShard(shard, testGroups) {
95
+ function filterForShard(shard, weights, testGroups) {
96
+ weights ??= Array.from({ length: shard.total }, () => 1);
97
+ if (weights.length !== shard.total)
98
+ throw new Error(`PWTEST_SHARD_WEIGHTS number of weights must match the shard total of ${shard.total}`);
99
+ const totalWeight = weights.reduce((a, b) => a + b, 0);
96
100
  let shardableTotal = 0;
97
101
  for (const group of testGroups)
98
102
  shardableTotal += group.tests.length;
99
- const shardSize = Math.floor(shardableTotal / shard.total);
100
- const extraOne = shardableTotal - shardSize * shard.total;
101
- const currentShard = shard.current - 1;
102
- const from = shardSize * currentShard + Math.min(extraOne, currentShard);
103
- const to = from + shardSize + (currentShard < extraOne ? 1 : 0);
103
+ const shardSizes = weights.map((w) => Math.floor(w * shardableTotal / totalWeight));
104
+ const remainder = shardableTotal - shardSizes.reduce((a, b) => a + b, 0);
105
+ for (let i = 0; i < remainder; i++) {
106
+ shardSizes[i % shardSizes.length]++;
107
+ }
108
+ let from = 0;
109
+ for (let i = 0; i < shard.current - 1; i++)
110
+ from += shardSizes[i];
111
+ const to = from + shardSizes[shard.current - 1];
104
112
  let current = 0;
105
113
  const result = /* @__PURE__ */ new Set();
106
114
  for (const group of testGroups) {
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runner/testGroups.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Suite, TestCase } from '../common/test';\n\nexport type TestGroup = {\n workerHash: string;\n requireFile: string;\n repeatEachIndex: number;\n projectId: string;\n tests: TestCase[];\n};\n\nexport function createTestGroups(projectSuite: Suite, expectedParallelism: number): TestGroup[] {\n // This function groups tests that can be run together.\n // Tests cannot be run together when:\n // - They belong to different projects - requires different workers.\n // - They have a different repeatEachIndex - requires different workers.\n // - They have a different set of worker fixtures in the pool - requires different workers.\n // - They have a different requireFile - reuses the worker, but runs each requireFile separately.\n // - They belong to a parallel suite.\n\n // Using the map \"workerHash -> requireFile -> group\" makes us preserve the natural order\n // of worker hashes and require files for the simple cases.\n const groups = new Map<string, Map<string, {\n // Tests that must be run in order are in the same group.\n general: TestGroup,\n\n // There are 3 kinds of parallel tests:\n // - Tests belonging to parallel suites, without beforeAll/afterAll hooks.\n // These can be run independently, they are put into their own group, key === test.\n // - Tests belonging to parallel suites, with beforeAll/afterAll hooks.\n // These should share the worker as much as possible, put into single parallelWithHooks group.\n // We'll divide them into equally-sized groups later.\n // - Tests belonging to serial suites inside parallel suites.\n // These should run as a serial group, each group is independent, key === serial suite.\n parallel: Map<Suite | TestCase, TestGroup>,\n parallelWithHooks: TestGroup,\n }>>();\n\n const createGroup = (test: TestCase): TestGroup => {\n return {\n workerHash: test._workerHash,\n requireFile: test._requireFile,\n repeatEachIndex: test.repeatEachIndex,\n projectId: test._projectId,\n tests: [],\n };\n };\n\n for (const test of projectSuite.allTests()) {\n let withWorkerHash = groups.get(test._workerHash);\n if (!withWorkerHash) {\n withWorkerHash = new Map();\n groups.set(test._workerHash, withWorkerHash);\n }\n let withRequireFile = withWorkerHash.get(test._requireFile);\n if (!withRequireFile) {\n withRequireFile = {\n general: createGroup(test),\n parallel: new Map(),\n parallelWithHooks: createGroup(test),\n };\n withWorkerHash.set(test._requireFile, withRequireFile);\n }\n\n // Note that a parallel suite cannot be inside a serial suite. This is enforced in TestType.\n let insideParallel = false;\n let outerMostSequentialSuite: Suite | undefined;\n let hasAllHooks = false;\n for (let parent: Suite | undefined = test.parent; parent; parent = parent.parent) {\n if (parent._parallelMode === 'serial' || parent._parallelMode === 'default')\n outerMostSequentialSuite = parent;\n insideParallel = insideParallel || parent._parallelMode === 'parallel';\n hasAllHooks = hasAllHooks || parent._hooks.some(hook => hook.type === 'beforeAll' || hook.type === 'afterAll');\n }\n\n if (insideParallel) {\n if (hasAllHooks && !outerMostSequentialSuite) {\n withRequireFile.parallelWithHooks.tests.push(test);\n } else {\n const key = outerMostSequentialSuite || test;\n let group = withRequireFile.parallel.get(key);\n if (!group) {\n group = createGroup(test);\n withRequireFile.parallel.set(key, group);\n }\n group.tests.push(test);\n }\n } else {\n withRequireFile.general.tests.push(test);\n }\n }\n\n const result: TestGroup[] = [];\n for (const withWorkerHash of groups.values()) {\n for (const withRequireFile of withWorkerHash.values()) {\n // Tests without parallel mode should run serially as a single group.\n if (withRequireFile.general.tests.length)\n result.push(withRequireFile.general);\n\n // Parallel test groups without beforeAll/afterAll can be run independently.\n result.push(...withRequireFile.parallel.values());\n\n // Tests with beforeAll/afterAll should try to share workers as much as possible.\n const parallelWithHooksGroupSize = Math.ceil(withRequireFile.parallelWithHooks.tests.length / expectedParallelism);\n let lastGroup: TestGroup | undefined;\n for (const test of withRequireFile.parallelWithHooks.tests) {\n if (!lastGroup || lastGroup.tests.length >= parallelWithHooksGroupSize) {\n lastGroup = createGroup(test);\n result.push(lastGroup);\n }\n lastGroup.tests.push(test);\n }\n }\n }\n return result;\n}\n\nexport function filterForShard(shard: { total: number, current: number }, testGroups: TestGroup[]): Set<TestGroup> {\n // Note that sharding works based on test groups.\n // This means parallel files will be sharded by single tests,\n // while non-parallel files will be sharded by the whole file.\n //\n // Shards are still balanced by the number of tests, not files,\n // even in the case of non-paralleled files.\n\n let shardableTotal = 0;\n for (const group of testGroups)\n shardableTotal += group.tests.length;\n\n // Each shard gets some tests.\n const shardSize = Math.floor(shardableTotal / shard.total);\n // First few shards get one more test each.\n const extraOne = shardableTotal - shardSize * shard.total;\n\n const currentShard = shard.current - 1; // Make it zero-based for calculations.\n const from = shardSize * currentShard + Math.min(extraOne, currentShard);\n const to = from + shardSize + (currentShard < extraOne ? 1 : 0);\n\n let current = 0;\n const result = new Set<TestGroup>();\n for (const group of testGroups) {\n // Any test group goes to the shard that contains the first test of this group.\n // So, this shard gets any group that starts at [from; to)\n if (current >= from && current < to)\n result.add(group);\n current += group.tests.length;\n }\n return result;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BO,SAAS,iBAAiB,cAAqB,qBAA0C;AAW9F,QAAM,SAAS,oBAAI,IAcf;AAEJ,QAAM,cAAc,CAAC,SAA8B;AACjD,WAAO;AAAA,MACL,YAAY,KAAK;AAAA,M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