@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.
- package/ThirdPartyNotices.txt +1188 -65
- package/lib/agents/agentParser.js +89 -0
- package/lib/agents/generateAgents.js +27 -74
- package/lib/agents/generateAgents.js.map +7 -0
- package/lib/agents/playwright-test-planner.agent.md +1 -0
- package/lib/common/config.js +6 -4
- package/lib/common/config.js.map +7 -0
- package/lib/common/configLoader.js.map +7 -0
- package/lib/common/esmLoaderHost.js +2 -0
- package/lib/common/esmLoaderHost.js.map +7 -0
- package/lib/common/expectBundle.js +2 -17
- package/lib/common/expectBundle.js.map +7 -0
- package/lib/common/expectBundleImpl.js +132 -132
- package/lib/common/expectBundleImpl.js.map +7 -0
- package/lib/common/fixtures.js.map +7 -0
- package/lib/common/globals.js.map +7 -0
- package/lib/common/ipc.js.map +7 -0
- package/lib/common/poolBuilder.js.map +7 -0
- package/lib/common/process.js +28 -0
- package/lib/common/process.js.map +7 -0
- package/lib/common/suiteUtils.js.map +7 -0
- package/lib/common/test.js.map +7 -0
- package/lib/common/testLoader.js.map +7 -0
- package/lib/common/testType.js.map +7 -0
- package/lib/common/validators.js +10 -10
- package/lib/common/validators.js.map +7 -0
- package/lib/fsWatcher.js.map +7 -0
- package/lib/index.js +205 -12
- package/lib/index.js.map +7 -0
- package/lib/internalsForTest.js.map +7 -0
- package/lib/isomorphic/events.js.map +7 -0
- package/lib/isomorphic/folders.js.map +7 -0
- package/lib/isomorphic/stringInternPool.js.map +7 -0
- package/lib/isomorphic/teleReceiver.js +15 -2
- package/lib/isomorphic/teleReceiver.js.map +7 -0
- package/lib/isomorphic/teleSuiteUpdater.js +24 -4
- package/lib/isomorphic/teleSuiteUpdater.js.map +7 -0
- package/lib/isomorphic/testServerConnection.js.map +7 -0
- package/lib/isomorphic/testServerInterface.js.map +7 -0
- package/lib/isomorphic/testTree.js +13 -18
- package/lib/isomorphic/testTree.js.map +7 -0
- package/lib/isomorphic/types.d.js.map +7 -0
- package/lib/loader/loaderMain.js.map +7 -0
- package/lib/matchers/expect.js +2 -15
- package/lib/matchers/expect.js.map +7 -0
- package/lib/matchers/matcherHint.js +1 -44
- package/lib/matchers/matcherHint.js.map +7 -0
- package/lib/matchers/matchers.js +3 -2
- package/lib/matchers/matchers.js.map +7 -0
- package/lib/matchers/toBeTruthy.js +5 -3
- package/lib/matchers/toBeTruthy.js.map +7 -0
- package/lib/matchers/toEqual.js +4 -3
- package/lib/matchers/toEqual.js.map +7 -0
- package/lib/matchers/toHaveURL.js +5 -6
- package/lib/matchers/toHaveURL.js.map +7 -0
- package/lib/matchers/toMatchAriaSnapshot.js +5 -5
- package/lib/matchers/toMatchAriaSnapshot.js.map +7 -0
- package/lib/matchers/toMatchSnapshot.js +9 -8
- package/lib/matchers/toMatchSnapshot.js.map +7 -0
- package/lib/matchers/toMatchText.js +9 -9
- package/lib/matchers/toMatchText.js.map +7 -0
- package/lib/mcp/browser/actions.d.js.map +7 -0
- package/lib/mcp/browser/browserContextFactory.js +62 -29
- package/lib/mcp/browser/browserContextFactory.js.map +7 -0
- package/lib/mcp/browser/browserServerBackend.js +17 -9
- package/lib/mcp/browser/browserServerBackend.js.map +7 -0
- package/lib/mcp/browser/codegen.js.map +7 -0
- package/lib/mcp/browser/config.js +65 -12
- package/lib/mcp/browser/config.js.map +7 -0
- package/lib/mcp/browser/context.js +71 -94
- package/lib/mcp/browser/context.js.map +7 -0
- package/lib/mcp/browser/response.js +172 -131
- package/lib/mcp/browser/response.js.map +7 -0
- package/lib/mcp/browser/sessionLog.js +19 -104
- package/lib/mcp/browser/sessionLog.js.map +7 -0
- package/lib/mcp/browser/tab.js +92 -41
- package/lib/mcp/browser/tab.js.map +7 -0
- package/lib/mcp/browser/tools/common.js +8 -6
- package/lib/mcp/browser/tools/common.js.map +7 -0
- package/lib/mcp/browser/tools/console.js +7 -5
- package/lib/mcp/browser/tools/console.js.map +7 -0
- package/lib/mcp/browser/tools/dialogs.js +4 -4
- package/lib/mcp/browser/tools/dialogs.js.map +7 -0
- package/lib/mcp/browser/tools/evaluate.js +11 -19
- package/lib/mcp/browser/tools/evaluate.js.map +7 -0
- package/lib/mcp/browser/tools/files.js +3 -3
- package/lib/mcp/browser/tools/files.js.map +7 -0
- package/lib/mcp/browser/tools/form.js +9 -19
- package/lib/mcp/browser/tools/form.js.map +7 -0
- package/lib/mcp/browser/tools/install.js +6 -3
- package/lib/mcp/browser/tools/install.js.map +7 -0
- package/lib/mcp/browser/tools/keyboard.js +34 -11
- package/lib/mcp/browser/tools/keyboard.js.map +7 -0
- package/lib/mcp/browser/tools/mouse.js +11 -11
- package/lib/mcp/browser/tools/mouse.js.map +7 -0
- package/lib/mcp/browser/tools/navigate.js +14 -5
- package/lib/mcp/browser/tools/navigate.js.map +7 -0
- package/lib/mcp/browser/tools/network.js +20 -11
- package/lib/mcp/browser/tools/network.js.map +7 -0
- package/lib/mcp/browser/tools/open.js +57 -0
- package/lib/mcp/browser/tools/pdf.js +9 -19
- package/lib/mcp/browser/tools/pdf.js.map +7 -0
- package/lib/mcp/browser/tools/runCode.js +11 -8
- package/lib/mcp/browser/tools/runCode.js.map +7 -0
- package/lib/mcp/browser/tools/screenshot.js +16 -29
- package/lib/mcp/browser/tools/screenshot.js.map +7 -0
- package/lib/mcp/browser/tools/snapshot.js +21 -29
- package/lib/mcp/browser/tools/snapshot.js.map +7 -0
- package/lib/mcp/browser/tools/tabs.js +12 -12
- package/lib/mcp/browser/tools/tabs.js.map +7 -0
- package/lib/mcp/browser/tools/tool.js +2 -4
- package/lib/mcp/browser/tools/tool.js.map +7 -0
- package/lib/mcp/browser/tools/tracing.js +6 -6
- package/lib/mcp/browser/tools/tracing.js.map +7 -0
- package/lib/mcp/browser/tools/utils.js +49 -44
- package/lib/mcp/browser/tools/utils.js.map +7 -0
- package/lib/mcp/browser/tools/verify.js +24 -34
- package/lib/mcp/browser/tools/verify.js.map +7 -0
- package/lib/mcp/browser/tools/wait.js +6 -6
- package/lib/mcp/browser/tools/wait.js.map +7 -0
- package/lib/mcp/browser/tools.js +3 -1
- package/lib/mcp/browser/tools.js.map +7 -0
- package/lib/mcp/browser/watchdog.js.map +7 -0
- package/lib/mcp/config.d.js.map +7 -0
- package/lib/mcp/extension/cdpRelay.js +1 -1
- package/lib/mcp/extension/cdpRelay.js.map +7 -0
- package/lib/mcp/extension/extensionContextFactory.js +6 -5
- package/lib/mcp/extension/extensionContextFactory.js.map +7 -0
- package/lib/mcp/extension/protocol.js.map +7 -0
- package/lib/mcp/index.js.map +7 -0
- package/lib/mcp/log.js.map +7 -0
- package/lib/mcp/program.js +15 -20
- package/lib/mcp/program.js.map +7 -0
- package/lib/mcp/sdk/bundle.js.map +7 -0
- package/lib/mcp/sdk/exports.js +0 -2
- package/lib/mcp/sdk/exports.js.map +7 -0
- package/lib/mcp/sdk/http.js +20 -55
- package/lib/mcp/sdk/http.js.map +7 -0
- package/lib/mcp/sdk/inProcessTransport.js.map +7 -0
- package/lib/mcp/sdk/proxyBackend.js.map +7 -0
- package/lib/mcp/sdk/server.js +29 -4
- package/lib/mcp/sdk/server.js.map +7 -0
- package/lib/mcp/sdk/tool.js +2 -2
- package/lib/mcp/sdk/tool.js.map +7 -0
- package/lib/mcp/terminal/cli.js +296 -0
- package/lib/mcp/terminal/command.js +56 -0
- package/lib/mcp/terminal/commands.js +333 -0
- package/lib/mcp/terminal/daemon.js +129 -0
- package/lib/mcp/terminal/help.json +32 -0
- package/lib/mcp/terminal/helpGenerator.js +88 -0
- package/lib/mcp/terminal/socketConnection.js +80 -0
- package/lib/mcp/test/browserBackend.js +3 -13
- package/lib/mcp/test/browserBackend.js.map +7 -0
- package/lib/mcp/test/generatorTools.js +9 -9
- package/lib/mcp/test/generatorTools.js.map +7 -0
- package/lib/mcp/test/plannerTools.js +23 -22
- package/lib/mcp/test/plannerTools.js.map +7 -0
- package/lib/mcp/test/seed.js.map +7 -0
- package/lib/mcp/test/streams.js.map +7 -0
- package/lib/mcp/test/testBackend.js +6 -6
- package/lib/mcp/test/testBackend.js.map +7 -0
- package/lib/mcp/test/testContext.js +9 -3
- package/lib/mcp/test/testContext.js.map +7 -0
- package/lib/mcp/test/testTool.js.map +7 -0
- package/lib/mcp/test/testTools.js +12 -10
- package/lib/mcp/test/testTools.js.map +7 -0
- package/lib/mcpBundleImpl.js.map +7 -0
- package/lib/plugins/gitCommitInfoPlugin.js.map +7 -0
- package/lib/plugins/index.js.map +7 -0
- package/lib/plugins/webServerPlugin.js.map +7 -0
- package/lib/program.js +18 -4
- package/lib/program.js.map +7 -0
- package/lib/reporters/base.js +29 -4
- package/lib/reporters/base.js.map +7 -0
- package/lib/reporters/blob.js +3 -0
- package/lib/reporters/blob.js.map +7 -0
- package/lib/reporters/dot.js +17 -0
- package/lib/reporters/dot.js.map +7 -0
- package/lib/reporters/empty.js.map +7 -0
- package/lib/reporters/github.js.map +7 -0
- package/lib/reporters/html.js +13 -3
- package/lib/reporters/html.js.map +7 -0
- package/lib/reporters/internalReporter.js +6 -0
- package/lib/reporters/internalReporter.js.map +7 -0
- package/lib/reporters/json.js.map +7 -0
- package/lib/reporters/junit.js.map +7 -0
- package/lib/reporters/line.js +18 -0
- package/lib/reporters/line.js.map +7 -0
- package/lib/reporters/list.js +22 -0
- package/lib/reporters/list.js.map +7 -0
- package/lib/reporters/listModeReporter.js.map +7 -0
- package/lib/reporters/markdown.js.map +7 -0
- package/lib/reporters/merge.js +25 -8
- package/lib/reporters/merge.js.map +7 -0
- package/lib/reporters/multiplexer.js +8 -0
- package/lib/reporters/multiplexer.js.map +7 -0
- package/lib/reporters/reporterV2.js.map +7 -0
- package/lib/reporters/smoothdeploy.js +191 -0
- package/lib/reporters/teleEmitter.js +22 -4
- package/lib/reporters/teleEmitter.js.map +7 -0
- package/lib/reporters/versions/blobV1.js.map +7 -0
- package/lib/runner/dispatcher.js +20 -4
- package/lib/runner/dispatcher.js.map +7 -0
- package/lib/runner/failureTracker.js.map +7 -0
- package/lib/runner/lastRun.js.map +7 -0
- package/lib/runner/loadUtils.js +2 -2
- package/lib/runner/loadUtils.js.map +7 -0
- package/lib/runner/loaderHost.js.map +7 -0
- package/lib/runner/processHost.js +19 -0
- package/lib/runner/processHost.js.map +7 -0
- package/lib/runner/projectUtils.js +1 -1
- package/lib/runner/projectUtils.js.map +7 -0
- package/lib/runner/rebase.js.map +7 -0
- package/lib/runner/reporters.js +3 -1
- package/lib/runner/reporters.js.map +7 -0
- package/lib/runner/sigIntWatcher.js.map +7 -0
- package/lib/runner/storage.js +91 -0
- package/lib/runner/taskRunner.js.map +7 -0
- package/lib/runner/tasks.js.map +7 -0
- package/lib/runner/testGroups.js +14 -6
- package/lib/runner/testGroups.js.map +7 -0
- package/lib/runner/testRunner.js +13 -4
- package/lib/runner/testRunner.js.map +7 -0
- package/lib/runner/testServer.js +2 -2
- package/lib/runner/testServer.js.map +7 -0
- package/lib/runner/uiModeReporter.js.map +7 -0
- package/lib/runner/vcs.js.map +7 -0
- package/lib/runner/watchMode.js +2 -1
- package/lib/runner/watchMode.js.map +7 -0
- package/lib/runner/workerHost.js +6 -0
- package/lib/runner/workerHost.js.map +7 -0
- package/lib/third_party/pirates.js.map +7 -0
- package/lib/third_party/tsconfig-loader.js.map +7 -0
- package/lib/transform/babelBundle.js +3 -0
- package/lib/transform/babelBundle.js.map +7 -0
- package/lib/transform/babelBundleImpl.js +134 -134
- package/lib/transform/babelBundleImpl.js.map +7 -0
- package/lib/transform/compilationCache.js +2 -0
- package/lib/transform/compilationCache.js.map +7 -0
- package/lib/transform/esmLoader.js +10 -11
- package/lib/transform/esmLoader.js.map +7 -0
- package/lib/transform/md.js +221 -0
- package/lib/transform/portTransport.js.map +7 -0
- package/lib/transform/transform.js +18 -8
- package/lib/transform/transform.js.map +7 -0
- package/lib/util.js +3 -6
- package/lib/util.js.map +7 -0
- package/lib/utilsBundle.js +7 -0
- package/lib/utilsBundle.js.map +7 -0
- package/lib/utilsBundleImpl.js +51 -48
- package/lib/utilsBundleImpl.js.map +7 -0
- package/lib/worker/fixtureRunner.js +6 -2
- package/lib/worker/fixtureRunner.js.map +7 -0
- package/lib/worker/testInfo.js +39 -19
- package/lib/worker/testInfo.js.map +7 -0
- package/lib/worker/testTracing.js.map +7 -0
- package/lib/worker/timeoutManager.js.map +7 -0
- package/lib/worker/util.js.map +7 -0
- package/lib/worker/workerMain.js +17 -16
- package/lib/worker/workerMain.js.map +7 -0
- package/package.json +2 -2
- package/test.mjs +1 -0
- package/types/test.d.ts +26 -6
- package/types/testReporter.d.ts +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/teleReceiver.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 type { Metadata, TestAnnotation } from '../../types/test';\nimport type * as reporterTypes from '../../types/testReporter';\nimport type { ReporterV2 } from '../reporters/reporterV2';\n\nexport type StringIntern = (s: string) => string;\nexport type JsonLocation = reporterTypes.Location;\nexport type JsonError = string;\nexport type JsonStackFrame = { file: string, line: number, column: number };\n\nexport type JsonStdIOType = 'stdout' | 'stderr';\n\nexport type JsonConfig = Pick<reporterTypes.FullConfig, 'configFile' | 'globalTimeout' | 'maxFailures' | 'metadata' | 'rootDir' | 'version' | 'workers' | 'globalSetup' | 'globalTeardown'> & {\n // optional for backwards compatibility\n tags?: reporterTypes.FullConfig['tags'],\n webServer?: reporterTypes.FullConfig['webServer'],\n};\n\nexport type JsonPattern = {\n s?: string;\n r?: { source: string, flags: string };\n};\n\nexport type JsonProject = {\n grep: JsonPattern[];\n grepInvert: JsonPattern[];\n metadata: Metadata;\n name: string;\n dependencies: string[];\n // This is relative to root dir.\n snapshotDir: string;\n // This is relative to root dir.\n outputDir: string;\n repeatEach: number;\n retries: number;\n suites: JsonSuite[];\n teardown?: string;\n // This is relative to root dir.\n testDir: string;\n testIgnore: JsonPattern[];\n testMatch: JsonPattern[];\n timeout: number;\n use: { [key: string]: any };\n};\n\nexport type JsonSuite = {\n title: string;\n location?: JsonLocation;\n entries: (JsonSuite | JsonTestCase)[];\n};\n\nexport type JsonTestCase = {\n testId: string;\n title: string;\n location: JsonLocation;\n retries: number;\n tags?: string[];\n repeatEachIndex: number;\n annotations?: TestAnnotation[];\n};\n\nexport type JsonTestEnd = {\n testId: string;\n expectedStatus: reporterTypes.TestStatus;\n timeout: number;\n // Dropped in 1.52. Kept as empty array for backwards compatibility.\n annotations: [];\n};\n\nexport type JsonTestResultStart = {\n id: string;\n retry: number;\n workerIndex: number;\n parallelIndex: number;\n startTime: number;\n};\n\nexport type JsonAttachment = Omit<reporterTypes.TestResult['attachments'][0], 'body'> & { base64?: string; };\n\nexport type JsonTestResultEnd = {\n id: string;\n duration: number;\n status: reporterTypes.TestStatus;\n errors: reporterTypes.TestError[];\n /** No longer emitted, but kept for backwards compatibility */\n attachments?: JsonAttachment[];\n annotations?: TestAnnotation[];\n};\n\nexport type JsonTestStepStart = {\n id: string;\n parentStepId?: string;\n title: string;\n category: string,\n startTime: number;\n location?: reporterTypes.Location;\n};\n\nexport type JsonTestStepEnd = {\n id: string;\n duration: number;\n error?: reporterTypes.TestError;\n attachments?: number[]; // index of JsonTestResultEnd.attachments\n annotations?: TestAnnotation[];\n};\n\nexport type JsonTestResultOnAttach = {\n testId: string;\n resultId: string;\n attachments: JsonAttachment[];\n};\n\nexport type JsonFullResult = {\n status: reporterTypes.FullResult['status'];\n startTime: number;\n duration: number;\n};\n\nexport type JsonEvent = JsonOnConfigureEvent | JsonOnBlobReportMetadataEvent | JsonOnEndEvent | JsonOnExitEvent | JsonOnProjectEvent | JsonOnBeginEvent | JsonOnTestBeginEvent\n | JsonOnTestEndEvent | JsonOnStepBeginEvent | JsonOnStepEndEvent | JsonOnAttachEvent | JsonOnErrorEvent | JsonOnStdIOEvent;\n\nexport type JsonOnConfigureEvent = {\n method: 'onConfigure';\n params: {\n config: JsonConfig;\n };\n};\n\nexport type JsonOnBlobReportMetadataEvent = {\n method: 'onBlobReportMetadata';\n params: BlobReportMetadata;\n};\n\nexport type JsonOnProjectEvent = {\n method: 'onProject';\n params: {\n project: JsonProject;\n };\n};\n\nexport type JsonOnBeginEvent = {\n method: 'onBegin';\n params: undefined;\n};\n\nexport type JsonOnTestBeginEvent = {\n method: 'onTestBegin';\n params: {\n testId: string;\n result: JsonTestResultStart;\n };\n};\n\nexport type JsonOnTestEndEvent = {\n method: 'onTestEnd';\n params: {\n test: JsonTestEnd;\n testId?: string;\n result: JsonTestResultEnd;\n };\n};\n\nexport type JsonOnStepBeginEvent = {\n method: 'onStepBegin';\n params: {\n testId: string;\n resultId: string;\n step: JsonTestStepStart;\n };\n};\n\nexport type JsonOnStepEndEvent = {\n method: 'onStepEnd';\n params: {\n testId: string;\n resultId: string;\n step: JsonTestStepEnd;\n };\n};\n\nexport type JsonOnAttachEvent = {\n method: 'onAttach';\n params: JsonTestResultOnAttach;\n};\n\nexport type JsonOnErrorEvent = {\n method: 'onError';\n params: {\n error: reporterTypes.TestError;\n };\n};\n\nexport type JsonOnStdIOEvent = {\n method: 'onStdIO';\n params: {\n type: JsonStdIOType;\n testId?: string;\n resultId?: string;\n data: string;\n isBase64: boolean;\n };\n};\n\nexport type JsonOnEndEvent = {\n method: 'onEnd';\n params: {\n result: JsonFullResult;\n };\n};\n\nexport type JsonOnExitEvent = {\n method: 'onExit';\n params: undefined;\n};\n\nexport type BlobReportMetadata = {\n version: number;\n userAgent: string;\n name?: string;\n shard?: { total: number, current: number };\n pathSeparator?: string;\n};\n\ntype TeleReporterReceiverOptions = {\n mergeProjects?: boolean;\n mergeTestCases?: boolean;\n resolvePath?: (rootDir: string, relativePath: string) => string;\n configOverrides?: Pick<reporterTypes.FullConfig, 'configFile' | 'quiet' | 'reportSlowTests' | 'reporter'>;\n clearPreviousResultsWhenTestBegins?: boolean;\n};\n\nexport class TeleReporterReceiver {\n public isListing = false;\n private _rootSuite: TeleSuite;\n private _options: TeleReporterReceiverOptions;\n private _reporter: ReporterV2;\n private _tests = new Map<string, TeleTestCase>();\n private _rootDir!: string;\n private _config!: reporterTypes.FullConfig;\n\n constructor(reporter: ReporterV2, options: TeleReporterReceiverOptions = {}) {\n this._rootSuite = new TeleSuite('', 'root');\n this._options = options;\n this._reporter = reporter;\n }\n\n reset() {\n this._rootSuite._entries = [];\n this._tests.clear();\n }\n\n dispatch(message: JsonEvent): Promise<void> | void {\n const { method, params } = message;\n if (method === 'onConfigure') {\n this._onConfigure(params.config);\n return;\n }\n if (method === 'onProject') {\n this._onProject(params.project);\n return;\n }\n if (method === 'onBegin') {\n this._onBegin();\n return;\n }\n if (method === 'onTestBegin') {\n this._onTestBegin(params.testId, params.result);\n return;\n }\n if (method === 'onTestEnd') {\n this._onTestEnd(params.test, params.result);\n return;\n }\n if (method === 'onStepBegin') {\n this._onStepBegin(params.testId, params.resultId, params.step);\n return;\n }\n if (method === 'onAttach') {\n this._onAttach(params.testId, params.resultId, params.attachments);\n return;\n }\n if (method === 'onStepEnd') {\n this._onStepEnd(params.testId, params.resultId, params.step);\n return;\n }\n if (method === 'onError') {\n this._onError(params.error);\n return;\n }\n if (method === 'onStdIO') {\n this._onStdIO(params.type, params.testId, params.resultId, params.data, params.isBase64);\n return;\n }\n if (method === 'onEnd')\n return this._onEnd(params.result);\n if (method === 'onExit')\n return this._onExit();\n }\n\n private _onConfigure(config: JsonConfig) {\n this._rootDir = config.rootDir;\n this._config = this._parseConfig(config);\n this._reporter.onConfigure?.(this._config);\n }\n\n private _onProject(project: JsonProject) {\n let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find(suite => suite.project()!.name === project.name) : undefined;\n if (!projectSuite) {\n projectSuite = new TeleSuite(project.name, 'project');\n this._rootSuite._addSuite(projectSuite);\n }\n // Always update project in watch mode.\n projectSuite._project = this._parseProject(project);\n for (const suite of project.suites)\n this._mergeSuiteInto(suite, projectSuite);\n }\n\n private _onBegin() {\n this._reporter.onBegin?.(this._rootSuite);\n }\n\n private _onTestBegin(testId: string, payload: JsonTestResultStart) {\n const test = this._tests.get(testId)!;\n if (this._options.clearPreviousResultsWhenTestBegins)\n test.results = [];\n const testResult = test._createTestResult(payload.id);\n testResult.retry = payload.retry;\n testResult.workerIndex = payload.workerIndex;\n testResult.parallelIndex = payload.parallelIndex;\n testResult.setStartTimeNumber(payload.startTime);\n this._reporter.onTestBegin?.(test, testResult);\n }\n\n private _onTestEnd(testEndPayload: JsonTestEnd, payload: JsonTestResultEnd) {\n const test = this._tests.get(testEndPayload.testId)!;\n test.timeout = testEndPayload.timeout;\n test.expectedStatus = testEndPayload.expectedStatus;\n const result = test.results.find(r => r._id === payload.id)!;\n result.duration = payload.duration;\n result.status = payload.status;\n result.errors = payload.errors;\n result.error = result.errors?.[0];\n // Attachments are only present here from legacy blobs. These override all _onAttach events\n if (!!payload.attachments)\n result.attachments = this._parseAttachments(payload.attachments);\n if (payload.annotations) {\n this._absoluteAnnotationLocationsInplace(payload.annotations);\n result.annotations = payload.annotations;\n test.annotations = payload.annotations;\n }\n this._reporter.onTestEnd?.(test, result);\n // Free up the memory as won't see these step ids.\n result._stepMap = new Map();\n }\n\n private _onStepBegin(testId: string, resultId: string, payload: JsonTestStepStart) {\n const test = this._tests.get(testId)!;\n const result = test.results.find(r => r._id === resultId)!;\n const parentStep = payload.parentStepId ? result._stepMap.get(payload.parentStepId) : undefined;\n\n const location = this._absoluteLocation(payload.location);\n const step = new TeleTestStep(payload, parentStep, location, result);\n if (parentStep)\n parentStep.steps.push(step);\n else\n result.steps.push(step);\n result._stepMap.set(payload.id, step);\n this._reporter.onStepBegin?.(test, result, step);\n }\n\n private _onStepEnd(testId: string, resultId: string, payload: JsonTestStepEnd) {\n const test = this._tests.get(testId)!;\n const result = test.results.find(r => r._id === resultId)!;\n const step = result._stepMap.get(payload.id)!;\n step._endPayload = payload;\n step.duration = payload.duration;\n step.error = payload.error;\n this._reporter.onStepEnd?.(test, result, step);\n }\n\n private _onAttach(testId: string, resultId: string, attachments: JsonAttachment[]) {\n const test = this._tests.get(testId)!;\n const result = test.results.find(r => r._id === resultId)!;\n result.attachments.push(...attachments.map(a => ({\n name: a.name,\n contentType: a.contentType,\n path: a.path,\n body: a.base64 && (globalThis as any).Buffer ? Buffer.from(a.base64, 'base64') : undefined,\n })));\n }\n\n private _onError(error: reporterTypes.TestError) {\n this._reporter.onError?.(error);\n }\n\n private _onStdIO(type: JsonStdIOType, testId: string | undefined, resultId: string | undefined, data: string, isBase64: boolean) {\n const chunk = isBase64 ? ((globalThis as any).Buffer ? Buffer.from(data, 'base64') : atob(data)) : data;\n const test = testId ? this._tests.get(testId) : undefined;\n const result = test && resultId ? test.results.find(r => r._id === resultId) : undefined;\n if (type === 'stdout') {\n result?.stdout.push(chunk);\n this._reporter.onStdOut?.(chunk, test, result);\n } else {\n result?.stderr.push(chunk);\n this._reporter.onStdErr?.(chunk, test, result);\n }\n }\n\n private async _onEnd(result: JsonFullResult): Promise<void> {\n await this._reporter.onEnd?.({\n status: result.status,\n startTime: new Date(result.startTime),\n duration: result.duration,\n });\n }\n\n private _onExit(): Promise<void> | void {\n return this._reporter.onExit?.();\n }\n\n private _parseConfig(config: JsonConfig): reporterTypes.FullConfig {\n const result = { ...baseFullConfig, ...config };\n if (this._options.configOverrides) {\n result.configFile = this._options.configOverrides.configFile;\n result.reportSlowTests = this._options.configOverrides.reportSlowTests;\n result.quiet = this._options.configOverrides.quiet;\n result.reporter = [...this._options.configOverrides.reporter];\n }\n return result;\n }\n\n private _parseProject(project: JsonProject): TeleFullProject {\n return {\n metadata: project.metadata,\n name: project.name,\n outputDir: this._absolutePath(project.outputDir),\n repeatEach: project.repeatEach,\n retries: project.retries,\n testDir: this._absolutePath(project.testDir),\n testIgnore: parseRegexPatterns(project.testIgnore),\n testMatch: parseRegexPatterns(project.testMatch),\n timeout: project.timeout,\n grep: parseRegexPatterns(project.grep) as RegExp[],\n grepInvert: parseRegexPatterns(project.grepInvert) as RegExp[],\n dependencies: project.dependencies,\n teardown: project.teardown,\n snapshotDir: this._absolutePath(project.snapshotDir),\n use: project.use,\n };\n }\n\n private _parseAttachments(attachments: JsonAttachment[]): reporterTypes.TestResult['attachments'] {\n return attachments.map(a => {\n return {\n ...a,\n body: a.base64 && (globalThis as any).Buffer ? Buffer.from(a.base64, 'base64') : undefined,\n };\n });\n }\n\n private _mergeSuiteInto(jsonSuite: JsonSuite, parent: TeleSuite): void {\n let targetSuite = parent.suites.find(s => s.title === jsonSuite.title);\n if (!targetSuite) {\n targetSuite = new TeleSuite(jsonSuite.title, parent.type === 'project' ? 'file' : 'describe');\n parent._addSuite(targetSuite);\n }\n targetSuite.location = this._absoluteLocation(jsonSuite.location);\n jsonSuite.entries.forEach(e => {\n if ('testId' in e)\n this._mergeTestInto(e, targetSuite!);\n else\n this._mergeSuiteInto(e, targetSuite!);\n });\n }\n\n private _mergeTestInto(jsonTest: JsonTestCase, parent: TeleSuite) {\n let targetTest = this._options.mergeTestCases ? parent.tests.find(s => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : undefined;\n if (!targetTest) {\n targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);\n parent._addTest(targetTest);\n this._tests.set(targetTest.id, targetTest);\n }\n this._updateTest(jsonTest, targetTest);\n }\n\n private _updateTest(payload: JsonTestCase, test: TeleTestCase): TeleTestCase {\n test.id = payload.testId;\n test.location = this._absoluteLocation(payload.location);\n test.retries = payload.retries;\n test.tags = payload.tags ?? [];\n test.annotations = payload.annotations ?? [];\n this._absoluteAnnotationLocationsInplace(test.annotations);\n return test;\n }\n\n private _absoluteAnnotationLocationsInplace(annotations: TestAnnotation[]) {\n for (const annotation of annotations) {\n if (annotation.location)\n annotation.location = this._absoluteLocation(annotation.location);\n }\n }\n\n private _absoluteLocation(location: reporterTypes.Location): reporterTypes.Location;\n private _absoluteLocation(location?: reporterTypes.Location): reporterTypes.Location | undefined;\n private _absoluteLocation(location: reporterTypes.Location | undefined): reporterTypes.Location | undefined {\n if (!location)\n return location;\n return {\n ...location,\n file: this._absolutePath(location.file),\n };\n }\n\n private _absolutePath(relativePath: string): string;\n private _absolutePath(relativePath?: string): string | undefined;\n private _absolutePath(relativePath?: string): string | undefined {\n if (relativePath === undefined)\n return;\n return this._options.resolvePath ? this._options.resolvePath(this._rootDir, relativePath) : this._rootDir + '/' + relativePath;\n }\n}\n\nexport class TeleSuite implements reporterTypes.Suite {\n title: string;\n location?: reporterTypes.Location;\n parent?: TeleSuite;\n _entries: (TeleSuite | TeleTestCase)[] = [];\n _requireFile: string = '';\n _timeout: number | undefined;\n _retries: number | undefined;\n _project: TeleFullProject | undefined;\n _parallelMode: 'none' | 'default' | 'serial' | 'parallel' = 'none';\n private readonly _type: 'root' | 'project' | 'file' | 'describe';\n\n constructor(title: string, type: 'root' | 'project' | 'file' | 'describe') {\n this.title = title;\n this._type = type;\n }\n\n get type() {\n return this._type;\n }\n\n get suites(): TeleSuite[] {\n return this._entries.filter(e => e.type !== 'test') as TeleSuite[];\n }\n\n get tests(): TeleTestCase[] {\n return this._entries.filter(e => e.type === 'test') as TeleTestCase[];\n }\n\n entries() {\n return this._entries;\n }\n\n allTests(): reporterTypes.TestCase[] {\n const result: reporterTypes.TestCase[] = [];\n const visit = (suite: reporterTypes.Suite) => {\n for (const entry of suite.entries()) {\n if (entry.type === 'test')\n result.push(entry);\n else\n visit(entry);\n }\n };\n visit(this);\n return result;\n }\n\n titlePath(): string[] {\n const titlePath = this.parent ? this.parent.titlePath() : [];\n // Ignore anonymous describe blocks.\n if (this.title || this._type !== 'describe')\n titlePath.push(this.title);\n return titlePath;\n }\n\n project(): TeleFullProject | undefined {\n return this._project ?? this.parent?.project();\n }\n\n _addTest(test: TeleTestCase) {\n test.parent = this;\n this._entries.push(test);\n }\n\n _addSuite(suite: TeleSuite) {\n suite.parent = this;\n this._entries.push(suite);\n }\n}\n\nexport class TeleTestCase implements reporterTypes.TestCase {\n title: string;\n fn = () => {};\n results: TeleTestResult[] = [];\n location: reporterTypes.Location;\n parent!: TeleSuite;\n type: 'test' = 'test';\n\n expectedStatus: reporterTypes.TestStatus = 'passed';\n timeout = 0;\n annotations: TestAnnotation[] = [];\n retries = 0;\n tags: string[] = [];\n repeatEachIndex = 0;\n id: string;\n\n constructor(id: string, title: string, location: reporterTypes.Location, repeatEachIndex: number) {\n this.id = id;\n this.title = title;\n this.location = location;\n this.repeatEachIndex = repeatEachIndex;\n }\n\n titlePath(): string[] {\n const titlePath = this.parent ? this.parent.titlePath() : [];\n titlePath.push(this.title);\n return titlePath;\n }\n\n outcome(): 'skipped' | 'expected' | 'unexpected' | 'flaky' {\n return computeTestCaseOutcome(this);\n }\n\n ok(): boolean {\n const status = this.outcome();\n return status === 'expected' || status === 'flaky' || status === 'skipped';\n }\n\n _createTestResult(id: string): TeleTestResult {\n const result = new TeleTestResult(this.results.length, id);\n this.results.push(result);\n return result;\n }\n}\n\nclass TeleTestStep implements reporterTypes.TestStep {\n title: string;\n category: string;\n location: reporterTypes.Location | undefined;\n parent: reporterTypes.TestStep | undefined;\n duration: number = -1;\n steps: reporterTypes.TestStep[] = [];\n error: reporterTypes.TestError | undefined;\n\n private _result: TeleTestResult;\n _endPayload?: JsonTestStepEnd;\n\n private _startTime: number = 0;\n\n constructor(payload: JsonTestStepStart, parentStep: reporterTypes.TestStep | undefined, location: reporterTypes.Location | undefined, result: TeleTestResult) {\n this.title = payload.title;\n this.category = payload.category;\n this.location = location;\n this.parent = parentStep;\n this._startTime = payload.startTime;\n this._result = result;\n }\n\n titlePath() {\n const parentPath = this.parent?.titlePath() || [];\n return [...parentPath, this.title];\n }\n\n get startTime(): Date {\n return new Date(this._startTime);\n }\n\n set startTime(value: Date) {\n this._startTime = +value;\n }\n\n get attachments() {\n return this._endPayload?.attachments?.map(index => this._result.attachments[index]) ?? [];\n }\n\n get annotations() {\n return this._endPayload?.annotations ?? [];\n }\n}\n\nexport class TeleTestResult implements reporterTypes.TestResult {\n retry: reporterTypes.TestResult['retry'];\n parallelIndex: reporterTypes.TestResult['parallelIndex'] = -1;\n workerIndex: reporterTypes.TestResult['workerIndex'] = -1;\n duration: reporterTypes.TestResult['duration'] = -1;\n stdout: reporterTypes.TestResult['stdout'] = [];\n stderr: reporterTypes.TestResult['stderr'] = [];\n attachments: reporterTypes.TestResult['attachments'] = [];\n annotations: reporterTypes.TestResult['annotations'] = [];\n status: reporterTypes.TestStatus = 'skipped';\n steps: TeleTestStep[] = [];\n errors: reporterTypes.TestResult['errors'] = [];\n error: reporterTypes.TestResult['error'];\n\n _stepMap = new Map<string, TeleTestStep>();\n _id: string;\n\n private _startTime: number = 0;\n\n constructor(retry: number, id: string) {\n this.retry = retry;\n this._id = id;\n }\n\n setStartTimeNumber(startTime: number) {\n this._startTime = startTime;\n }\n\n get startTime(): Date {\n return new Date(this._startTime);\n }\n\n set startTime(value: Date) {\n this._startTime = +value;\n }\n}\n\nexport type TeleFullProject = reporterTypes.FullProject;\n\nexport const baseFullConfig: reporterTypes.FullConfig = {\n forbidOnly: false,\n fullyParallel: false,\n globalSetup: null,\n globalTeardown: null,\n globalTimeout: 0,\n grep: /.*/,\n grepInvert: null,\n maxFailures: 0,\n metadata: {},\n preserveOutput: 'always',\n projects: [],\n reporter: [[process.env.CI ? 'dot' : 'list']],\n reportSlowTests: { max: 5, threshold: 300_000 /* 5 minutes */ },\n configFile: '',\n rootDir: '',\n quiet: false,\n shard: null,\n tags: [],\n updateSnapshots: 'missing',\n updateSourceMethod: 'patch',\n version: '',\n workers: 0,\n webServer: null,\n};\n\nexport function serializeRegexPatterns(patterns: string | RegExp | (string | RegExp)[]): JsonPattern[] {\n if (!Array.isArray(patterns))\n patterns = [patterns];\n return patterns.map(s => {\n if (typeof s === 'string')\n return { s };\n return { r: { source: s.source, flags: s.flags } };\n });\n}\n\nexport function parseRegexPatterns(patterns: JsonPattern[]): (string | RegExp)[] {\n return patterns.map(p => {\n if (p.s !== undefined)\n return p.s;\n return new RegExp(p.r!.source, p.r!.flags);\n });\n}\n\nexport function computeTestCaseOutcome(test: reporterTypes.TestCase) {\n let skipped = 0;\n let didNotRun = 0;\n let expected = 0;\n let interrupted = 0;\n let unexpected = 0;\n for (const result of test.results) {\n if (result.status === 'interrupted') {\n ++interrupted; // eslint-disable-line @typescript-eslint/no-unused-vars\n } else if (result.status === 'skipped' && test.expectedStatus === 'skipped') {\n // Only tests \"expected to be skipped\" are skipped. These were specifically\n // marked with test.skip or test.fixme.\n ++skipped;\n } else if (result.status === 'skipped') {\n // Tests that were expected to run, but were skipped are \"did not run\".\n // This happens when:\n // - testing finished early;\n // - test failure prevented other tests in the serial suite to run;\n // - probably more cases!\n ++didNotRun; // eslint-disable-line @typescript-eslint/no-unused-vars\n } else if (result.status === test.expectedStatus) {\n // Either passed and expected to pass, or failed and expected to fail.\n ++expected;\n } else {\n ++unexpected;\n }\n }\n\n // Tests that were \"skipped as expected\" are considered equal to \"expected\" below,\n // because that's the expected outcome.\n //\n // However, we specifically differentiate the case of \"only skipped\"\n // and show it as \"skipped\" in all reporters.\n //\n // More exotic cases like \"failed on first run and skipped on retry\" are flaky.\n if (expected === 0 && unexpected === 0)\n return 'skipped'; // all results were skipped or interrupted\n if (unexpected === 0)\n return 'expected'; // no failures, just expected+skipped\n if (expected === 0 && skipped === 0)\n return 'unexpected'; // only failures\n return 'flaky'; // expected+unexpected or skipped+unexpected\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;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
this._receiver = new import_teleReceiver.TeleReporterReceiver(this._createReporter(), {
|
|
37
37
|
mergeProjects: true,
|
|
38
38
|
mergeTestCases: true,
|
|
39
|
-
resolvePath: (
|
|
39
|
+
resolvePath: createPathResolve(options.pathSeparator),
|
|
40
40
|
clearPreviousResultsWhenTestBegins: true
|
|
41
41
|
});
|
|
42
42
|
this._options = options;
|
|
@@ -44,8 +44,8 @@ class TeleSuiteUpdater {
|
|
|
44
44
|
_createReporter() {
|
|
45
45
|
return {
|
|
46
46
|
version: () => "v2",
|
|
47
|
-
onConfigure: (
|
|
48
|
-
this.config =
|
|
47
|
+
onConfigure: (config) => {
|
|
48
|
+
this.config = config;
|
|
49
49
|
this._lastRunReceiver = new import_teleReceiver.TeleReporterReceiver({
|
|
50
50
|
version: () => "v2",
|
|
51
51
|
onBegin: (suite) => {
|
|
@@ -55,8 +55,9 @@ class TeleSuiteUpdater {
|
|
|
55
55
|
}, {
|
|
56
56
|
mergeProjects: true,
|
|
57
57
|
mergeTestCases: false,
|
|
58
|
-
resolvePath: (
|
|
58
|
+
resolvePath: createPathResolve(this._options.pathSeparator)
|
|
59
59
|
});
|
|
60
|
+
void this._lastRunReceiver.dispatch({ method: "onConfigure", params: { config } });
|
|
60
61
|
},
|
|
61
62
|
onBegin: (suite) => {
|
|
62
63
|
if (!this.rootSuite)
|
|
@@ -131,6 +132,25 @@ class TeleSuiteUpdater {
|
|
|
131
132
|
};
|
|
132
133
|
}
|
|
133
134
|
}
|
|
135
|
+
function createPathResolve(pathSeparator) {
|
|
136
|
+
return (rootDir, relativePath) => {
|
|
137
|
+
const segments = [];
|
|
138
|
+
for (const segment of [...rootDir.split(pathSeparator), ...relativePath.split(pathSeparator)]) {
|
|
139
|
+
const isAfterDrive = pathSeparator === "\\" && segments.length === 1 && segments[0].endsWith(":");
|
|
140
|
+
const isFirst = !segments.length;
|
|
141
|
+
if (!segment && !isFirst && !isAfterDrive)
|
|
142
|
+
continue;
|
|
143
|
+
if (segment === ".")
|
|
144
|
+
continue;
|
|
145
|
+
if (segment === "..") {
|
|
146
|
+
segments.pop();
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
segments.push(segment);
|
|
150
|
+
}
|
|
151
|
+
return segments.join(pathSeparator);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
134
154
|
// Annotate the CommonJS export names for ESM import in node:
|
|
135
155
|
0 && (module.exports = {
|
|
136
156
|
TeleSuiteUpdater
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/teleSuiteUpdater.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 { TeleReporterReceiver, TeleSuite } from './teleReceiver';\nimport { statusEx } from './testTree';\n\nimport type * as reporterTypes from '../../types/testReporter';\nimport type { ReporterV2 } from '../reporters/reporterV2';\n\nexport type TeleSuiteUpdaterProgress = {\n total: number;\n passed: number;\n failed: number;\n skipped: number;\n};\n\nexport type TeleSuiteUpdaterTestModel = {\n config: reporterTypes.FullConfig;\n rootSuite: reporterTypes.Suite;\n loadErrors: reporterTypes.TestError[];\n progress: TeleSuiteUpdaterProgress;\n};\n\nexport type TeleSuiteUpdaterOptions = {\n onUpdate: (force?: boolean) => void,\n onError?: (error: reporterTypes.TestError) => void;\n pathSeparator: string;\n};\n\nexport class TeleSuiteUpdater {\n rootSuite: TeleSuite | undefined;\n config: reporterTypes.FullConfig | undefined;\n readonly loadErrors: reporterTypes.TestError[] = [];\n readonly progress: TeleSuiteUpdaterProgress = {\n total: 0,\n passed: 0,\n failed: 0,\n skipped: 0,\n };\n\n private _receiver: TeleReporterReceiver;\n private _lastRunReceiver: TeleReporterReceiver | undefined;\n private _lastRunTestCount = 0;\n private _options: TeleSuiteUpdaterOptions;\n private _testResultsSnapshot: Map<string, reporterTypes.TestResult[]> | undefined;\n\n constructor(options: TeleSuiteUpdaterOptions) {\n this._receiver = new TeleReporterReceiver(this._createReporter(), {\n mergeProjects: true,\n mergeTestCases: true,\n resolvePath: (rootDir, relativePath) => rootDir + options.pathSeparator + relativePath,\n clearPreviousResultsWhenTestBegins: true,\n });\n this._options = options;\n }\n\n private _createReporter(): ReporterV2 {\n return {\n version: () => 'v2',\n\n onConfigure: (c: reporterTypes.FullConfig) => {\n this.config = c;\n // TeleReportReceiver is merging everything into a single suite, so when we\n // run one test, we still get many tests via rootSuite.allTests().length.\n // To work around that, have a dedicated per-run receiver that will only have\n // suite for a single test run, and hence will have correct total.\n this._lastRunReceiver = new TeleReporterReceiver({\n version: () => 'v2',\n onBegin: (suite: reporterTypes.Suite) => {\n this._lastRunTestCount = suite.allTests().length;\n this._lastRunReceiver = undefined;\n }\n }, {\n mergeProjects: true,\n mergeTestCases: false,\n resolvePath: (rootDir, relativePath) => rootDir + this._options.pathSeparator + relativePath,\n });\n },\n\n onBegin: (suite: reporterTypes.Suite) => {\n if (!this.rootSuite)\n this.rootSuite = suite as TeleSuite;\n // As soon as new test tree is built add previous results, before calling onUpdate\n // to avoid flashing empty results in the UI.\n if (this._testResultsSnapshot) {\n for (const test of this.rootSuite.allTests())\n test.results = this._testResultsSnapshot?.get(test.id) || test.results;\n this._testResultsSnapshot = undefined;\n }\n this.progress.total = this._lastRunTestCount;\n this.progress.passed = 0;\n this.progress.failed = 0;\n this.progress.skipped = 0;\n this._options.onUpdate(true);\n },\n\n onEnd: () => {\n this._options.onUpdate(true);\n },\n\n onTestBegin: (test: reporterTypes.TestCase, testResult: reporterTypes.TestResult) => {\n (testResult as any)[statusEx] = 'running';\n this._options.onUpdate();\n },\n\n onTestEnd: (test: reporterTypes.TestCase, testResult: reporterTypes.TestResult) => {\n if (test.outcome() === 'skipped')\n ++this.progress.skipped;\n else if (test.outcome() === 'unexpected')\n ++this.progress.failed;\n else\n ++this.progress.passed;\n (testResult as any)[statusEx] = testResult.status;\n this._options.onUpdate();\n },\n\n onError: (error: reporterTypes.TestError) => this._handleOnError(error),\n\n printsToStdio: () => false,\n };\n }\n\n processGlobalReport(report: any[]) {\n const receiver = new TeleReporterReceiver({\n version: () => 'v2',\n onConfigure: (c: reporterTypes.FullConfig) => {\n this.config = c;\n },\n onError: (error: reporterTypes.TestError) => this._handleOnError(error)\n });\n for (const message of report)\n void receiver.dispatch(message);\n }\n\n processListReport(report: any[]) {\n // Save test results and reset all projects, the results will be restored after\n // new project structure is built.\n const tests = this.rootSuite?.allTests() || [];\n this._testResultsSnapshot = new Map(tests.map(test => [test.id, test.results]));\n this._receiver.reset();\n for (const message of report)\n void this._receiver.dispatch(message);\n }\n\n processTestReportEvent(message: any) {\n // The order of receiver dispatches matters here, we want to assign `lastRunTestCount`\n // before we use it.\n this._lastRunReceiver?.dispatch(message)?.catch(() => { });\n this._receiver.dispatch(message)?.catch(() => { });\n }\n\n private _handleOnError(error: reporterTypes.TestError) {\n this.loadErrors.push(error);\n this._options.onError?.(error);\n this._options.onUpdate();\n }\n\n asModel(): TeleSuiteUpdaterTestModel {\n return {\n rootSuite: this.rootSuite || new TeleSuite('', 'root'),\n config: this.config!,\n loadErrors: this.loadErrors,\n progress: this.progress,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,0BAAgD;AAChD,sBAAyB;AAyBlB,MAAM,iBAAiB;AAAA,EAiB5B,YAAY,SAAkC;AAd9C,SAAS,aAAwC,CAAC;AAClD,SAAS,WAAqC;AAAA,MAC5C,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR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MACL,WAAW,KAAK,aAAa,IAAI,8BAAU,IAAI,MAAM;AAAA,MACrD,QAAQ,KAAK;AAAA,MACb,YAAY,KAAK;AAAA,MACjB,UAAU,KAAK;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/testServerConnection.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 * as events from './events';\n\nimport type { TestServerInterface, TestServerInterfaceEvents } from '@testIsomorphic/testServerInterface';\nimport type * as reporterTypes from '../../types/testReporter';\n\n// -- Reuse boundary -- Everything below this line is reused in the vscode extension.\n\nexport class TestServerConnectionClosedError extends Error {\n constructor() {\n super('Test server connection closed');\n }\n}\n\nexport interface TestServerTransport {\n onmessage(listener: (message: string) => void): void;\n onopen(listener: () => void): void;\n onerror(listener: () => void): void;\n onclose(listener: () => void): void;\n\n send(data: string): void;\n close(): void;\n}\n\nexport class WebSocketTestServerTransport implements TestServerTransport {\n private _ws: WebSocket;\n\n constructor(url: string | URL) {\n this._ws = new WebSocket(url);\n }\n\n onmessage(listener: (message: string) => void) {\n this._ws.addEventListener('message', event => listener(event.data.toString()));\n }\n\n onopen(listener: () => void) {\n this._ws.addEventListener('open', listener);\n }\n\n onerror(listener: () => void) {\n this._ws.addEventListener('error', listener);\n }\n\n onclose(listener: () => void) {\n this._ws.addEventListener('close', listener);\n }\n\n send(data: string) {\n this._ws.send(data);\n }\n\n close() {\n this._ws.close();\n }\n}\n\nexport class TestServerConnection implements TestServerInterface, TestServerInterfaceEvents {\n readonly onClose: events.Event<void>;\n readonly onReport: events.Event<any>;\n readonly onStdio: events.Event<{ type: 'stderr' | 'stdout'; text?: string | undefined; buffer?: string | undefined; }>;\n readonly onTestFilesChanged: events.Event<{ testFiles: string[] }>;\n readonly onLoadTraceRequested: events.Event<{ traceUrl: string }>;\n readonly onTestPaused: events.Event<{ errors: reporterTypes.TestError[] }>;\n\n private _onCloseEmitter = new events.EventEmitter<void>();\n private _onReportEmitter = new events.EventEmitter<any>();\n private _onStdioEmitter = new events.EventEmitter<{ type: 'stderr' | 'stdout'; text?: string | undefined; buffer?: string | undefined; }>();\n private _onTestFilesChangedEmitter = new events.EventEmitter<{ testFiles: string[] }>();\n private _onLoadTraceRequestedEmitter = new events.EventEmitter<{ traceUrl: string }>();\n private _onTestPausedEmitter = new events.EventEmitter<{ errors: reporterTypes.TestError[] }>();\n\n private _lastId = 0;\n private _transport: TestServerTransport;\n private _callbacks = new Map<number, { resolve: (arg: any) => void, reject: (arg: Error) => void }>();\n private _connectedPromise: Promise<void>;\n private _isClosed = false;\n\n constructor(transport: TestServerTransport) {\n this.onClose = this._onCloseEmitter.event;\n this.onReport = this._onReportEmitter.event;\n this.onStdio = this._onStdioEmitter.event;\n this.onTestFilesChanged = this._onTestFilesChangedEmitter.event;\n this.onLoadTraceRequested = this._onLoadTraceRequestedEmitter.event;\n this.onTestPaused = this._onTestPausedEmitter.event;\n\n this._transport = transport;\n this._transport.onmessage(data => {\n const message = JSON.parse(data);\n const { id, result, error, method, params } = message;\n if (id) {\n const callback = this._callbacks.get(id);\n if (!callback)\n return;\n this._callbacks.delete(id);\n if (error)\n callback.reject(new Error(error));\n else\n callback.resolve(result);\n } else {\n this._dispatchEvent(method, params);\n }\n });\n const pingInterval = setInterval(() => this._sendMessage('ping').catch(() => { }), 30000);\n this._connectedPromise = new Promise<void>((f, r) => {\n this._transport.onopen(f);\n this._transport.onerror(r);\n });\n this._transport.onclose(() => {\n this._isClosed = true;\n this._onCloseEmitter.fire();\n clearInterval(pingInterval);\n for (const callback of this._callbacks.values())\n callback.reject(new TestServerConnectionClosedError());\n this._callbacks.clear();\n });\n }\n\n isClosed(): boolean {\n return this._isClosed;\n }\n\n private async _sendMessage(method: string, params?: any): Promise<any> {\n const logForTest = (globalThis as any).__logForTest;\n logForTest?.({ method, params });\n\n await this._connectedPromise;\n const id = ++this._lastId;\n const message = { id, method, params };\n this._transport.send(JSON.stringify(message));\n return new Promise((resolve, reject) => {\n this._callbacks.set(id, { resolve, reject });\n });\n }\n\n private _sendMessageNoReply(method: string, params?: any) {\n this._sendMessage(method, params).catch(() => { });\n }\n\n private _dispatchEvent(method: string, params?: any) {\n if (method === 'report')\n this._onReportEmitter.fire(params);\n else if (method === 'stdio')\n this._onStdioEmitter.fire(params);\n else if (method === 'testFilesChanged')\n this._onTestFilesChangedEmitter.fire(params);\n else if (method === 'loadTraceRequested')\n this._onLoadTraceRequestedEmitter.fire(params);\n else if (method === 'testPaused')\n this._onTestPausedEmitter.fire(params);\n }\n\n async initialize(params: Parameters<TestServerInterface['initialize']>[0]): ReturnType<TestServerInterface['initialize']> {\n await this._sendMessage('initialize', params);\n }\n\n async ping(params: Parameters<TestServerInterface['ping']>[0]): ReturnType<TestServerInterface['ping']> {\n await this._sendMessage('ping', params);\n }\n\n async pingNoReply(params: Parameters<TestServerInterface['ping']>[0]) {\n this._sendMessageNoReply('ping', params);\n }\n\n async watch(params: Parameters<TestServerInterface['watch']>[0]): ReturnType<TestServerInterface['watch']> {\n await this._sendMessage('watch', params);\n }\n\n watchNoReply(params: Parameters<TestServerInterface['watch']>[0]) {\n this._sendMessageNoReply('watch', params);\n }\n\n async open(params: Parameters<TestServerInterface['open']>[0]): ReturnType<TestServerInterface['open']> {\n await this._sendMessage('open', params);\n }\n\n openNoReply(params: Parameters<TestServerInterface['open']>[0]) {\n this._sendMessageNoReply('open', params);\n }\n\n async resizeTerminal(params: Parameters<TestServerInterface['resizeTerminal']>[0]): ReturnType<TestServerInterface['resizeTerminal']> {\n await this._sendMessage('resizeTerminal', params);\n }\n\n resizeTerminalNoReply(params: Parameters<TestServerInterface['resizeTerminal']>[0]) {\n this._sendMessageNoReply('resizeTerminal', params);\n }\n\n async checkBrowsers(params: Parameters<TestServerInterface['checkBrowsers']>[0]): ReturnType<TestServerInterface['checkBrowsers']> {\n return await this._sendMessage('checkBrowsers', params);\n }\n\n async installBrowsers(params: Parameters<TestServerInterface['installBrowsers']>[0]): ReturnType<TestServerInterface['installBrowsers']> {\n await this._sendMessage('installBrowsers', params);\n }\n\n async runGlobalSetup(params: Parameters<TestServerInterface['runGlobalSetup']>[0]): ReturnType<TestServerInterface['runGlobalSetup']> {\n return await this._sendMessage('runGlobalSetup', params);\n }\n\n async runGlobalTeardown(params: Parameters<TestServerInterface['runGlobalTeardown']>[0]): ReturnType<TestServerInterface['runGlobalTeardown']> {\n return await this._sendMessage('runGlobalTeardown', params);\n }\n\n async startDevServer(params: Parameters<TestServerInterface['startDevServer']>[0]): ReturnType<TestServerInterface['startDevServer']> {\n return await this._sendMessage('startDevServer', params);\n }\n\n async stopDevServer(params: Parameters<TestServerInterface['stopDevServer']>[0]): ReturnType<TestServerInterface['stopDevServer']> {\n return await this._sendMessage('stopDevServer', params);\n }\n\n async clearCache(params: Parameters<TestServerInterface['clearCache']>[0]): ReturnType<TestServerInterface['clearCache']> {\n return await this._sendMessage('clearCache', params);\n }\n\n async listFiles(params: Parameters<TestServerInterface['listFiles']>[0]): ReturnType<TestServerInterface['listFiles']> {\n return await this._sendMessage('listFiles', params);\n }\n\n async listTests(params: Parameters<TestServerInterface['listTests']>[0]): ReturnType<TestServerInterface['listTests']> {\n return await this._sendMessage('listTests', params);\n }\n\n async runTests(params: Parameters<TestServerInterface['runTests']>[0]): ReturnType<TestServerInterface['runTests']> {\n return await this._sendMessage('runTests', params);\n }\n\n async findRelatedTestFiles(params: Parameters<TestServerInterface['findRelatedTestFiles']>[0]): ReturnType<TestServerInterface['findRelatedTestFiles']> {\n return await this._sendMessage('findRelatedTestFiles', params);\n }\n\n async stopTests(params: Parameters<TestServerInterface['stopTests']>[0]): ReturnType<TestServerInterface['stopTests']> {\n await this._sendMessage('stopTests', params);\n }\n\n stopTestsNoReply(params: Parameters<TestServerInterface['stopTests']>[0]) {\n this._sendMessageNoReply('stopTests', params);\n }\n\n async closeGracefully(params: Parameters<TestServerInterface['closeGracefully']>[0]): ReturnType<TestServerInterface['closeGracefully']> {\n await this._sendMessage('closeGracefully', params);\n }\n\n close() {\n try {\n this._transport.close();\n } catch {\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,aAAwB;AAOjB,MAAM,wCAAwC,MAAM;AAAA,EACzD,cAAc;AACZ,UAAM,+BAA+B;AAAA,EACvC;AACF;AAYO,MAAM,6BAA4D;AAAA,EAGvE,YAAY,KAAmB;AAC7B,SAAK,MAAM,IAAI,UAAU,GAAG;AAAA,EAC9B;AAAA,EAEA,UAAU,UAAqC;AAC7C,SAAK,IAAI,iBAAiB,WAAW,WAAS,SAAS,MAAM,KAAK,SAAS,CAAC,CAAC;AAAA,EAC/E;AAAA,EAEA,OAAO,UAAsB;AAC3B,SAAK,IAAI,iBAAiB,QAAQ,QAAQ;AAAA,EAC5C;AAAA,EAEA,QAAQ,UAAsB;AAC5B,SAAK,IAAI,iBAAiB,SAAS,QAAQ;AAAA,EAC7C;AAAA,EAEA,QAAQ,UAAsB;AAC5B,SAAK,IAAI,iBAAiB,SAAS,QAAQ;AAAA,EAC7C;AAAA,EAEA,KAAK,MAAc;AACjB,SAAK,IAAI,KAAK,IAAI;AAAA,EACpB;AAAA,EAEA,QAAQ;AACN,SAAK,IAAI,MAAM;AAAA,EACjB;AACF;AAEO,MAAM,qBAA+E;AAAA,EAqB1F,YAAY,WAAgC;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,MAAM;AAAA,EACpD;AAAA,EAEA,MAAM,SAAS,QAAqG;AAClH,WAAO,MAAM,KAAK,aAAa,YAAY,MAAM;AAAA,EACnD;AAAA,EAEA,MAAM,qBAAqB,QAA6H;AACtJ,WAAO,MAAM,KAAK,aAAa,wBAAwB,MAAM;AAAA,EAC/D;AAAA,EAEA,MAAM,UAAU,QAAuG;AACrH,UAAM,KAAK,aAAa,aAAa,MAAM;AAAA,EAC7C;AAAA,EAEA,iBAAiB,QAAyD;AACxE,SAAK,oBAAoB,aAAa,MAAM;AAAA,EAC9C;AAAA,EAEA,MAAM,gBAAgB,QAAmH;AACvI,UAAM,KAAK,aAAa,mBAAmB,MAAM;AAAA,EACnD;AAAA,EAEA,QAAQ;AACN,QAAI;AACF,WAAK,WAAW,MAAM;AAAA,IACxB,QAAQ;AAAA,IACR;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/testServerInterface.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 type { Event } from './events';\nimport type { JsonEvent } from './teleReceiver';\nimport type * as reporterTypes from '../../types/testReporter';\n\n// -- Reuse boundary -- Everything below this line is reused in the vscode extension.\n\nexport type ReportEntry = JsonEvent;\n\nexport interface TestServerInterface {\n initialize(params: {\n serializer?: string,\n closeOnDisconnect?: boolean,\n interceptStdio?: boolean,\n watchTestDirs?: boolean,\n populateDependenciesOnList?: boolean,\n }): Promise<void>;\n\n ping(params: {}): Promise<void>;\n\n watch(params: {\n fileNames: string[];\n }): Promise<void>;\n\n open(params: { location: reporterTypes.Location }): Promise<void>;\n\n resizeTerminal(params: { cols: number, rows: number }): Promise<void>;\n\n checkBrowsers(params: {}): Promise<{ hasBrowsers: boolean }>;\n\n installBrowsers(params: {}): Promise<void>;\n\n runGlobalSetup(params: {}): Promise<{\n report: ReportEntry[],\n status: reporterTypes.FullResult['status']\n }>;\n\n runGlobalTeardown(params: {}): Promise<{\n report: ReportEntry[],\n status: reporterTypes.FullResult['status']\n }>;\n\n startDevServer(params: {}): Promise<{\n report: ReportEntry[];\n status: reporterTypes.FullResult['status']\n }>;\n\n stopDevServer(params: {}): Promise<{\n report: ReportEntry[];\n status: reporterTypes.FullResult['status']\n }>;\n\n clearCache(params: {}): Promise<void>;\n\n listFiles(params: {\n projects?: string[];\n }): Promise<{\n report: ReportEntry[];\n status: reporterTypes.FullResult['status']\n }>;\n\n /**\n * Returns list of teleReporter events.\n */\n listTests(params: {\n projects?: string[];\n locations?: string[];\n grep?: string;\n grepInvert?: string;\n }): Promise<{\n report: ReportEntry[],\n status: reporterTypes.FullResult['status']\n }>;\n\n runTests(params: {\n locations?: string[];\n grep?: string;\n grepInvert?: string;\n testIds?: string[];\n headed?: boolean;\n workers?: number | string;\n updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';\n updateSourceMethod?: 'overwrite' | 'patch' | '3way';\n reporters?: string[],\n trace?: 'on' | 'off';\n video?: 'on' | 'off';\n projects?: string[];\n reuseContext?: boolean;\n connectWsEndpoint?: string;\n timeout?: number;\n pauseOnError?: boolean;\n pauseAtEnd?: boolean;\n }): Promise<{\n status: reporterTypes.FullResult['status'];\n }>;\n\n findRelatedTestFiles(params: {\n files: string[];\n }): Promise<{ testFiles: string[]; errors?: reporterTypes.TestError[]; }>;\n\n stopTests(params: {}): Promise<void>;\n\n closeGracefully(params: {}): Promise<void>;\n}\n\nexport interface TestServerInterfaceEvents {\n onReport: Event<any>;\n onStdio: Event<{ type: 'stdout' | 'stderr', text?: string, buffer?: string }>;\n onTestFilesChanged: Event<{ testFiles: string[] }>;\n onLoadTraceRequested: Event<{ traceUrl: string }>;\n onTestPaused: Event<{ errors: reporterTypes.TestError[] }>;\n}\n\nexport interface TestServerInterfaceEventEmitters {\n dispatchEvent(event: 'report', params: ReportEntry): void;\n dispatchEvent(event: 'stdio', params: { type: 'stdout' | 'stderr', text?: string, buffer?: string }): void;\n dispatchEvent(event: 'testFilesChanged', params: { testFiles: string[] }): void;\n dispatchEvent(event: 'loadTraceRequested', params: { traceUrl: string }): void;\n dispatchEvent(event: 'testPaused', params: { errors: reporterTypes.TestError[] }): void;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -19,7 +19,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var testTree_exports = {};
|
|
20
20
|
__export(testTree_exports, {
|
|
21
21
|
TestTree: () => TestTree,
|
|
22
|
-
collectTestIds: () => collectTestIds,
|
|
23
22
|
sortAndPropagateStatus: () => sortAndPropagateStatus,
|
|
24
23
|
statusEx: () => statusEx
|
|
25
24
|
});
|
|
@@ -242,16 +241,6 @@ class TestTree {
|
|
|
242
241
|
shortRoot.location = this.rootItem.location;
|
|
243
242
|
this.rootItem = shortRoot;
|
|
244
243
|
}
|
|
245
|
-
testIds() {
|
|
246
|
-
const result = /* @__PURE__ */ new Set();
|
|
247
|
-
const visit = (treeItem) => {
|
|
248
|
-
if (treeItem.kind === "case")
|
|
249
|
-
treeItem.tests.forEach((t) => result.add(t.id));
|
|
250
|
-
treeItem.children.forEach(visit);
|
|
251
|
-
};
|
|
252
|
-
visit(this.rootItem);
|
|
253
|
-
return result;
|
|
254
|
-
}
|
|
255
244
|
fileNames() {
|
|
256
245
|
const result = /* @__PURE__ */ new Set();
|
|
257
246
|
const visit = (treeItem) => {
|
|
@@ -276,7 +265,7 @@ class TestTree {
|
|
|
276
265
|
return this._treeItemById.get(id);
|
|
277
266
|
}
|
|
278
267
|
collectTestIds(treeItem) {
|
|
279
|
-
return
|
|
268
|
+
return collectTestIds(treeItem);
|
|
280
269
|
}
|
|
281
270
|
}
|
|
282
271
|
function sortAndPropagateStatus(treeItem) {
|
|
@@ -313,22 +302,28 @@ function sortAndPropagateStatus(treeItem) {
|
|
|
313
302
|
}
|
|
314
303
|
function collectTestIds(treeItem) {
|
|
315
304
|
const testIds = /* @__PURE__ */ new Set();
|
|
305
|
+
const locations = /* @__PURE__ */ new Set();
|
|
316
306
|
const visit = (treeItem2) => {
|
|
307
|
+
if (treeItem2.kind !== "test" && treeItem2.kind !== "case") {
|
|
308
|
+
treeItem2.children.forEach(visit);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
let fileItem = treeItem2;
|
|
312
|
+
while (fileItem && fileItem.parent && !(fileItem.kind === "group" && fileItem.subKind === "file"))
|
|
313
|
+
fileItem = fileItem.parent;
|
|
314
|
+
locations.add(fileItem.location.file);
|
|
317
315
|
if (treeItem2.kind === "case")
|
|
318
|
-
treeItem2.tests.
|
|
319
|
-
else if (treeItem2.kind === "test")
|
|
320
|
-
testIds.add(treeItem2.id);
|
|
316
|
+
treeItem2.tests.forEach((test) => testIds.add(test.id));
|
|
321
317
|
else
|
|
322
|
-
treeItem2.
|
|
318
|
+
testIds.add(treeItem2.id);
|
|
323
319
|
};
|
|
324
320
|
visit(treeItem);
|
|
325
|
-
return testIds;
|
|
321
|
+
return { testIds, locations };
|
|
326
322
|
}
|
|
327
323
|
const statusEx = Symbol("statusEx");
|
|
328
324
|
// Annotate the CommonJS export names for ESM import in node:
|
|
329
325
|
0 && (module.exports = {
|
|
330
326
|
TestTree,
|
|
331
|
-
collectTestIds,
|
|
332
327
|
sortAndPropagateStatus,
|
|
333
328
|
statusEx
|
|
334
329
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/testTree.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 type TestItemStatus = 'none' | 'running' | 'scheduled' | 'passed' | 'failed' | 'skipped';\nimport type * as reporterTypes from '../../types/testReporter';\n\n// -- Reuse boundary -- Everything below this line is reused in the vscode extension.\n\nexport type TreeItemBase = {\n kind: 'root' | 'group' | 'case' | 'test',\n id: string;\n title: string;\n location: reporterTypes.Location,\n duration: number;\n parent: TreeItem | undefined;\n children: TreeItem[];\n status: TestItemStatus;\n};\n\nexport type GroupItem = TreeItemBase & {\n kind: 'group';\n subKind: 'folder' | 'file' | 'describe';\n hasLoadErrors: boolean;\n children: (TestCaseItem | GroupItem)[];\n};\n\nexport type TestCaseItem = TreeItemBase & {\n kind: 'case',\n tests: reporterTypes.TestCase[];\n children: TestItem[];\n test: reporterTypes.TestCase | undefined;\n project: reporterTypes.FullProject | undefined;\n tags: Array<string>;\n};\n\nexport type TestItem = TreeItemBase & {\n kind: 'test',\n test: reporterTypes.TestCase;\n project: reporterTypes.FullProject;\n};\n\nexport type TreeItem = GroupItem | TestCaseItem | TestItem;\n\nexport class TestTree {\n rootItem: GroupItem;\n private _treeItemById = new Map<string, TreeItem>();\n private _treeItemByTestId = new Map<string, TestItem | TestCaseItem>();\n readonly pathSeparator: string;\n\n constructor(rootFolder: string, rootSuite: reporterTypes.Suite | undefined, loadErrors: reporterTypes.TestError[], projectFilters: Map<string, boolean> | undefined, pathSeparator: string, hideFiles: boolean) {\n const filterProjects = projectFilters && [...projectFilters.values()].some(Boolean);\n this.pathSeparator = pathSeparator;\n this.rootItem = {\n kind: 'group',\n subKind: 'folder',\n id: rootFolder,\n title: '',\n location: { file: '', line: 0, column: 0 },\n duration: 0,\n parent: undefined,\n children: [],\n status: 'none',\n hasLoadErrors: false,\n };\n this._treeItemById.set(rootFolder, this.rootItem);\n\n const visitSuite = (project: reporterTypes.FullProject, parentSuite: reporterTypes.Suite, parentGroup: GroupItem, mode: 'tests' | 'suites' | 'all') => {\n for (const suite of mode === 'tests' ? [] : parentSuite.suites) {\n if (!suite.title) {\n // Flatten anonymous describes.\n visitSuite(project, suite, parentGroup, 'all');\n continue;\n }\n\n let group = parentGroup.children.find(item => item.kind === 'group' && item.title === suite.title) as GroupItem | undefined;\n if (!group) {\n group = {\n kind: 'group',\n subKind: 'describe',\n id: 'suite:' + parentSuite.titlePath().join('\\x1e') + '\\x1e' + suite.title, // account for anonymous suites\n title: suite.title,\n location: suite.location!,\n duration: 0,\n parent: parentGroup,\n children: [],\n status: 'none',\n hasLoadErrors: false,\n };\n this._addChild(parentGroup, group);\n }\n visitSuite(project, suite, group, 'all');\n }\n\n for (const test of mode === 'suites' ? [] : parentSuite.tests) {\n const title = test.title;\n let testCaseItem = parentGroup.children.find(t => t.kind !== 'group' && t.title === title) as TestCaseItem;\n if (!testCaseItem) {\n testCaseItem = {\n kind: 'case',\n id: 'test:' + test.titlePath().join('\\x1e'),\n title,\n parent: parentGroup,\n children: [],\n tests: [],\n location: test.location,\n duration: 0,\n status: 'none',\n project: undefined,\n test: undefined,\n tags: test.tags,\n };\n this._addChild(parentGroup, testCaseItem);\n }\n\n const result = test.results[0];\n let status: 'none' | 'running' | 'scheduled' | 'passed' | 'failed' | 'skipped' = 'none';\n if ((result as any)?.[statusEx] === 'scheduled')\n status = 'scheduled';\n else if ((result as any)?.[statusEx] === 'running')\n status = 'running';\n else if (result?.status === 'skipped')\n status = 'skipped';\n else if (result?.status === 'interrupted')\n status = 'none';\n else if (result && test.outcome() !== 'expected')\n status = 'failed';\n else if (result && test.outcome() === 'expected')\n status = 'passed';\n\n testCaseItem.tests.push(test);\n const testItem: TestItem = {\n kind: 'test',\n id: test.id,\n title: project.name,\n location: test.location!,\n test,\n parent: testCaseItem,\n children: [],\n status,\n duration: test.results.length ? Math.max(0, test.results[0].duration) : 0,\n project,\n };\n this._addChild(testCaseItem, testItem);\n this._treeItemByTestId.set(test.id, testItem);\n testCaseItem.duration = (testCaseItem.children as TestItem[]).reduce((a, b) => a + b.duration, 0);\n }\n };\n\n for (const projectSuite of rootSuite?.suites || []) {\n if (filterProjects && !projectFilters.get(projectSuite.title))\n continue;\n for (const fileSuite of projectSuite.suites) {\n if (hideFiles) {\n visitSuite(projectSuite.project()!, fileSuite, this.rootItem, 'suites');\n if (fileSuite.tests.length) {\n const defaultDescribeItem = this._defaultDescribeItem();\n visitSuite(projectSuite.project()!, fileSuite, defaultDescribeItem, 'tests');\n }\n } else {\n const fileItem = this._fileItem(fileSuite.location!.file.split(pathSeparator), true);\n visitSuite(projectSuite.project()!, fileSuite, fileItem, 'all');\n }\n }\n }\n\n for (const loadError of loadErrors) {\n if (!loadError.location)\n continue;\n const fileItem = this._fileItem(loadError.location.file.split(pathSeparator), true);\n fileItem.hasLoadErrors = true;\n }\n }\n\n private _addChild(parent: TreeItem, child: TreeItem) {\n parent.children.push(child);\n child.parent = parent;\n this._treeItemById.set(child.id, child);\n }\n\n filterTree(filterText: string, statusFilters: Map<string, boolean>, runningTestIds: Set<string> | undefined) {\n const tokens = filterText.trim().toLowerCase().split(' ');\n const filtersStatuses = [...statusFilters.values()].some(Boolean);\n\n const filter = (testCase: TestCaseItem) => {\n const titleWithTags = [...testCase.tests[0].titlePath(), ...testCase.tests[0].tags].join(' ').toLowerCase();\n if (!tokens.every(token => titleWithTags.includes(token)) && !testCase.tests.some(t => runningTestIds?.has(t.id)))\n return false;\n testCase.children = (testCase.children as TestItem[]).filter(test => {\n return !filtersStatuses || runningTestIds?.has(test.test.id) || statusFilters.get(test.status);\n });\n testCase.tests = (testCase.children as TestItem[]).map(c => c.test);\n return !!testCase.children.length;\n };\n\n const visit = (treeItem: GroupItem) => {\n const newChildren: (GroupItem | TestCaseItem)[] = [];\n for (const child of treeItem.children) {\n if (child.kind === 'case') {\n if (filter(child))\n newChildren.push(child);\n } else {\n visit(child);\n if (child.children.length || child.hasLoadErrors)\n newChildren.push(child);\n }\n }\n treeItem.children = newChildren;\n };\n visit(this.rootItem);\n }\n\n private _fileItem(filePath: string[], isFile: boolean): GroupItem {\n if (filePath.length === 0)\n return this.rootItem;\n const fileName = filePath.join(this.pathSeparator);\n const existingFileItem = this._treeItemById.get(fileName);\n if (existingFileItem)\n return existingFileItem as GroupItem;\n const parentFileItem = this._fileItem(filePath.slice(0, filePath.length - 1), false);\n const fileItem: GroupItem = {\n kind: 'group',\n subKind: isFile ? 'file' : 'folder',\n id: fileName,\n title: filePath[filePath.length - 1],\n location: { file: fileName, line: 0, column: 0 },\n duration: 0,\n parent: parentFileItem,\n children: [],\n status: 'none',\n hasLoadErrors: false,\n };\n this._addChild(parentFileItem, fileItem);\n return fileItem;\n }\n\n private _defaultDescribeItem(): GroupItem {\n let defaultDescribeItem = this._treeItemById.get('<anonymous>') as GroupItem;\n if (!defaultDescribeItem) {\n defaultDescribeItem = {\n kind: 'group',\n subKind: 'describe',\n id: '<anonymous>',\n title: '<anonymous>',\n location: { file: '', line: 0, column: 0 },\n duration: 0,\n parent: this.rootItem,\n children: [],\n status: 'none',\n hasLoadErrors: false,\n };\n this._addChild(this.rootItem, defaultDescribeItem);\n }\n return defaultDescribeItem;\n }\n\n sortAndPropagateStatus() {\n sortAndPropagateStatus(this.rootItem);\n }\n\n flattenForSingleProject() {\n const visit = (treeItem: TreeItem) => {\n if (treeItem.kind === 'case' && treeItem.children.length === 1) {\n treeItem.project = treeItem.children[0].project;\n treeItem.test = treeItem.children[0].test;\n treeItem.children = [];\n this._treeItemByTestId.set(treeItem.test.id, treeItem);\n } else {\n treeItem.children.forEach(visit);\n }\n };\n visit(this.rootItem);\n }\n\n shortenRoot() {\n let shortRoot = this.rootItem;\n while (shortRoot.children.length === 1 && shortRoot.children[0].kind === 'group' && shortRoot.children[0].subKind === 'folder')\n shortRoot = shortRoot.children[0];\n shortRoot.location = this.rootItem.location;\n this.rootItem = shortRoot;\n }\n\n testIds(): Set<string> {\n const result = new Set<string>();\n const visit = (treeItem: TreeItem) => {\n if (treeItem.kind === 'case')\n treeItem.tests.forEach(t => result.add(t.id));\n treeItem.children.forEach(visit);\n };\n visit(this.rootItem);\n return result;\n }\n\n fileNames(): string[] {\n const result = new Set<string>();\n const visit = (treeItem: TreeItem) => {\n if (treeItem.kind === 'group' && treeItem.subKind === 'file')\n result.add(treeItem.id);\n else\n treeItem.children.forEach(visit);\n };\n visit(this.rootItem);\n return [...result];\n }\n\n flatTreeItems(): TreeItem[] {\n const result: TreeItem[] = [];\n const visit = (treeItem: TreeItem) => {\n result.push(treeItem);\n treeItem.children.forEach(visit);\n };\n visit(this.rootItem);\n return result;\n }\n\n treeItemById(id: string): TreeItem | undefined {\n return this._treeItemById.get(id);\n }\n\n collectTestIds(treeItem?: TreeItem): Set<string> {\n return treeItem ? collectTestIds(treeItem) : new Set();\n }\n}\n\nexport function sortAndPropagateStatus(treeItem: TreeItem) {\n for (const child of treeItem.children)\n sortAndPropagateStatus(child);\n\n if (treeItem.kind === 'group') {\n treeItem.children.sort((a, b) => {\n const fc = a.location.file.localeCompare(b.location.file);\n return fc || a.location.line - b.location.line;\n });\n }\n\n let allPassed = treeItem.children.length > 0;\n let allSkipped = treeItem.children.length > 0;\n let hasFailed = false;\n let hasRunning = false;\n let hasScheduled = false;\n\n for (const child of treeItem.children) {\n allSkipped = allSkipped && child.status === 'skipped';\n allPassed = allPassed && (child.status === 'passed' || child.status === 'skipped');\n hasFailed = hasFailed || child.status === 'failed';\n hasRunning = hasRunning || child.status === 'running';\n hasScheduled = hasScheduled || child.status === 'scheduled';\n }\n\n if (hasRunning)\n treeItem.status = 'running';\n else if (hasScheduled)\n treeItem.status = 'scheduled';\n else if (hasFailed)\n treeItem.status = 'failed';\n else if (allSkipped)\n treeItem.status = 'skipped';\n else if (allPassed)\n treeItem.status = 'passed';\n}\n\nexport function collectTestIds(treeItem: TreeItem): Set<string> {\n const testIds = new Set<string>();\n const visit = (treeItem: TreeItem) => {\n if (treeItem.kind === 'case')\n treeItem.tests.map(t => t.id).forEach(id => testIds.add(id));\n else if (treeItem.kind === 'test')\n testIds.add(treeItem.id);\n else\n treeItem.children?.forEach(visit);\n };\n visit(treeItem);\n return testIds;\n}\n\nexport const statusEx = Symbol('statusEx');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDO,MAAM,SAAS;AAAA,EAMpB,YAAY,YAAoB,WAA4C,YAAuC,gBAAkD,eAAuB,WAAoB;AAJhN,SAAQ,gBAAgB,oBAAI,IAAsB;AAClD,SAAQ,oBAAoB,oBAAI,IAAqC;AAInE,UAAM,iBAAiB,kBAAkB,CAAC,GAAG,eAAe,OAAO,CAAC,EAAE,KAAK,OAAO;AAClF,SAAK,gBAAgB;AACrB,SAAK,WAAW;AAAA,MACd,MAAM;AAAA,MACN,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,UAAU,EAAE,MAAM,IAAI,MAAM,GAAG,QAAQ,EAAE;AAAA,MACzC,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU,CAAC;AAAA,MACX,QAAQ;AAAA,MACR,eAAe;AAAA,IACjB;AACA,SAAK,cAAc,IAAI,YAAY,KAAK,QAAQ;AAEhD,UAAM,aAAa,CAAC,SAAoC,aAAkC,aAAwB,SAAqC;AACrJ,iBAAW,SAAS,SAAS,UAAU,CAAC,IAAI,YAAY,QAAQ;AAC9D,YAAI,CAAC,MAAM,OAAO;AAEhB,qBAAW,SA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,UAAS,SAAS;AACzB,cAAQ,IAAIA,UAAS,EAAE;AAAA;AAEvB,MAAAA,UAAS,UAAU,QAAQ,KAAK;AAAA,EACpC;AACA,QAAM,QAAQ;AACd,SAAO;AACT;AAEO,MAAM,WAAW,OAAO,UAAU;",
|
|
6
|
+
"names": ["treeItem"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isomorphic/types.d.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 type GitCommitInfo = {\n shortHash: string;\n hash: string;\n subject: string;\n body: string;\n author: {\n name: string;\n email: string;\n time: number;\n };\n committer: {\n name: string;\n email: string\n time: number;\n };\n branch: string;\n};\n\nexport type CIInfo = {\n commitHref: string;\n prHref?: string;\n prTitle?: string;\n prBaseHash?: string;\n buildHref?: string;\n commitHash?: string;\n branch?: string;\n};\n\nexport type MetadataWithCommitInfo = {\n ci?: CIInfo;\n gitCommit?: GitCommitInfo;\n gitDiff?: string;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/loader/loaderMain.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 { deserializeConfig } from '../common/configLoader';\nimport { incorporateCompilationCache } from '../common/esmLoaderHost';\nimport { PoolBuilder } from '../common/poolBuilder';\nimport { ProcessRunner } from '../common/process';\nimport { loadTestFile } from '../common/testLoader';\nimport { serializeCompilationCache } from '../transform/compilationCache';\n\nimport type { TestError } from '../../types/testReporter';\nimport type { FullConfigInternal } from '../common/config';\nimport type { SerializedConfig } from '../common/ipc';\n\nexport class LoaderMain extends ProcessRunner {\n private _serializedConfig: SerializedConfig;\n private _configPromise: Promise<FullConfigInternal> | undefined;\n private _poolBuilder = PoolBuilder.createForLoader();\n\n constructor(serializedConfig: SerializedConfig) {\n super();\n this._serializedConfig = serializedConfig;\n }\n\n private _config(): Promise<FullConfigInternal> {\n if (!this._configPromise)\n this._configPromise = deserializeConfig(this._serializedConfig);\n return this._configPromise;\n }\n\n async loadTestFile(params: { file: string }) {\n const testErrors: TestError[] = [];\n const config = await this._config();\n const fileSuite = await loadTestFile(params.file, config, testErrors);\n this._poolBuilder.buildPools(fileSuite);\n return { fileSuite: fileSuite._deepSerialize(), testErrors };\n }\n\n async getCompilationCacheFromLoader() {\n await incorporateCompilationCache();\n return serializeCompilationCache();\n }\n}\n\nexport const create = (config: SerializedConfig) => new LoaderMain(config);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,0BAAkC;AAClC,2BAA4C;AAC5C,yBAA4B;AAC5B,qBAA8B;AAC9B,wBAA6B;AAC7B,8BAA0C;AAMnC,MAAM,mBAAmB,6BAAc;AAAA,EAK5C,YAAY,kBAAoC;AAC9C,UAAM;AAHR,SAAQ,eAAe,+BAAY,gBAAgB;AAIjD,SAAK,oBAAoB;AAAA,EAC3B;AAAA,EAEQ,UAAuC;AAC7C,QAAI,CAAC,KAAK;AACR,WAAK,qBAAiB,uCAAkB,KAAK,iBAAiB;AAChE,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,aAAa,QAA0B;AAC3C,UAAM,aAA0B,CAAC;AACjC,UAAM,SAAS,MAAM,KAAK,QAAQ;AAClC,UAAM,YAAY,UAAM,gCAAa,OAAO,MAAM,QAAQ,UAAU;AACpE,SAAK,aAAa,WAAW,SAAS;AACtC,WAAO,EAAE,WAAW,UAAU,eAAe,GAAG,WAAW;AAAA,EAC7D;AAAA,EAEA,MAAM,gCAAgC;AACpC,cAAM,kDAA4B;AAClC,eAAO,mDAA0B;AAAA,EACnC;AACF;AAEO,MAAM,SAAS,CAAC,WAA6B,IAAI,WAAW,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/matchers/expect.js
CHANGED
|
@@ -19,9 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var expect_exports = {};
|
|
20
20
|
__export(expect_exports, {
|
|
21
21
|
expect: () => expect,
|
|
22
|
-
mergeExpects: () => mergeExpects
|
|
23
|
-
printReceivedStringContainExpectedResult: () => printReceivedStringContainExpectedResult,
|
|
24
|
-
printReceivedStringContainExpectedSubstring: () => printReceivedStringContainExpectedSubstring
|
|
22
|
+
mergeExpects: () => mergeExpects
|
|
25
23
|
});
|
|
26
24
|
module.exports = __toCommonJS(expect_exports);
|
|
27
25
|
var import_utils = require("playwright-core/lib/utils");
|
|
@@ -33,15 +31,6 @@ var import_expectBundle = require("../common/expectBundle");
|
|
|
33
31
|
var import_globals = require("../common/globals");
|
|
34
32
|
var import_util = require("../util");
|
|
35
33
|
var import_testInfo = require("../worker/testInfo");
|
|
36
|
-
const printSubstring = (val) => val.replace(/"|\\/g, "\\$&");
|
|
37
|
-
const printReceivedStringContainExpectedSubstring = (received, start, length) => (0, import_expectBundle.RECEIVED_COLOR)(
|
|
38
|
-
'"' + printSubstring(received.slice(0, start)) + (0, import_expectBundle.INVERTED_COLOR)(printSubstring(received.slice(start, start + length))) + printSubstring(received.slice(start + length)) + '"'
|
|
39
|
-
);
|
|
40
|
-
const printReceivedStringContainExpectedResult = (received, result) => result === null ? (0, import_expectBundle.printReceived)(received) : printReceivedStringContainExpectedSubstring(
|
|
41
|
-
received,
|
|
42
|
-
result.index,
|
|
43
|
-
result[0].length
|
|
44
|
-
);
|
|
45
34
|
function createMatchers(actual, info, prefix) {
|
|
46
35
|
return new Proxy((0, import_expectBundle.expect)(actual), new ExpectMetaInfoProxyHandler(actual, info, prefix));
|
|
47
36
|
}
|
|
@@ -318,7 +307,5 @@ function mergeExpects(...expects) {
|
|
|
318
307
|
// Annotate the CommonJS export names for ESM import in node:
|
|
319
308
|
0 && (module.exports = {
|
|
320
309
|
expect,
|
|
321
|
-
mergeExpects
|
|
322
|
-
printReceivedStringContainExpectedResult,
|
|
323
|
-
printReceivedStringContainExpectedSubstring
|
|
310
|
+
mergeExpects
|
|
324
311
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/matchers/expect.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 {\n captureRawStack,\n createGuid,\n currentZone,\n escapeWithQuotes,\n isString,\n pollAgainstDeadline } from 'playwright-core/lib/utils';\n\nimport { ExpectError, isJestError } from './matcherHint';\nimport {\n computeMatcherTitleSuffix,\n toBeAttached,\n toBeChecked,\n toBeDisabled,\n toBeEditable,\n toBeEmpty,\n toBeEnabled,\n toBeFocused,\n toBeHidden,\n toBeInViewport,\n toBeOK,\n toBeVisible,\n toContainClass,\n toContainText,\n toHaveAccessibleDescription,\n toHaveAccessibleErrorMessage,\n toHaveAccessibleName,\n toHaveAttribute,\n toHaveCSS,\n toHaveClass,\n toHaveCount,\n toHaveId,\n toHaveJSProperty,\n toHaveRole,\n toHaveText,\n toHaveTitle,\n toHaveURL,\n toHaveValue,\n toHaveValues,\n toPass\n} from './matchers';\nimport { toMatchAriaSnapshot } from './toMatchAriaSnapshot';\nimport { toHaveScreenshot, toMatchSnapshot } from './toMatchSnapshot';\nimport {\n INVERTED_COLOR,\n RECEIVED_COLOR,\n expect as expectLibrary,\n printReceived,\n} from '../common/expectBundle';\nimport { currentTestInfo } from '../common/globals';\nimport { filteredStackTrace } from '../util';\nimport { TestInfoImpl } from '../worker/testInfo';\n\nimport type { ExpectMatcherStateInternal } from './matchers';\nimport type { Expect } from '../../types/test';\nimport type { TestStepInfoImpl } from '../worker/testInfo';\n\n\n// #region\n// Mirrored from https://github.com/facebook/jest/blob/f13abff8df9a0e1148baf3584bcde6d1b479edc7/packages/expect/src/print.ts\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found here\n * https://github.com/facebook/jest/blob/1547740bbc26400d69f4576bf35645163e942829/LICENSE\n */\n\n// Format substring but do not enclose in double quote marks.\n// The replacement is compatible with pretty-format package.\nconst printSubstring = (val: string): string => val.replace(/\"|\\\\/g, '\\\\$&');\n\nexport const printReceivedStringContainExpectedSubstring = (\n received: string,\n start: number,\n length: number, // not end\n): string =>\n RECEIVED_COLOR(\n '\"' +\n printSubstring(received.slice(0, start)) +\n INVERTED_COLOR(printSubstring(received.slice(start, start + length))) +\n printSubstring(received.slice(start + length)) +\n '\"',\n );\n\nexport const printReceivedStringContainExpectedResult = (\n received: string,\n result: RegExpExecArray | null,\n): string =>\n result === null\n ? printReceived(received)\n : printReceivedStringContainExpectedSubstring(\n received,\n result.index,\n result[0].length,\n );\n\n// #endregion\n\ntype ExpectMessage = string | { message?: string };\n\nfunction createMatchers(actual: unknown, info: ExpectMetaInfo, prefix: string[]): any {\n return new Proxy(expectLibrary(actual), new ExpectMetaInfoProxyHandler(actual, info, prefix));\n}\n\nconst userMatchersSymbol = Symbol('userMatchers');\n\nfunction qualifiedMatcherName(qualifier: string[], matcherName: string) {\n return qualifier.join(':') + '$' + matcherName;\n}\n\nfunction createExpect(info: ExpectMetaInfo, prefix: string[], userMatchers: Record<string, Function>) {\n const expectInstance: Expect<{}> = new Proxy(expectLibrary, {\n apply: function(target: any, thisArg: any, argumentsList: [unknown, ExpectMessage?]) {\n const [actual, messageOrOptions] = argumentsList;\n const message = isString(messageOrOptions) ? messageOrOptions : messageOrOptions?.message || info.message;\n const newInfo = { ...info, message };\n if (newInfo.poll) {\n if (typeof actual !== 'function')\n throw new Error('`expect.poll()` accepts only function as a first argument');\n newInfo.poll.generator = actual as any;\n }\n return createMatchers(actual, newInfo, prefix);\n },\n\n get: function(target: any, property: string | typeof userMatchersSymbol) {\n if (property === 'configure')\n return configure;\n\n if (property === 'extend') {\n return (matchers: any) => {\n const qualifier = [...prefix, createGuid()];\n\n const wrappedMatchers: any = {};\n for (const [name, matcher] of Object.entries(matchers)) {\n wrappedMatchers[name] = wrapPlaywrightMatcherToPassNiceThis(matcher);\n const key = qualifiedMatcherName(qualifier, name);\n wrappedMatchers[key] = wrappedMatchers[name];\n Object.defineProperty(wrappedMatchers[key], 'name', { value: name });\n }\n expectLibrary.extend(wrappedMatchers);\n return createExpect(info, qualifier, { ...userMatchers, ...matchers });\n };\n }\n\n if (property === 'soft') {\n return (actual: unknown, messageOrOptions?: ExpectMessage) => {\n return configure({ soft: true })(actual, messageOrOptions) as any;\n };\n }\n\n if (property === userMatchersSymbol)\n return userMatchers;\n\n if (property === 'poll') {\n return (actual: unknown, messageOrOptions?: ExpectMessage & { timeout?: number, intervals?: number[] }) => {\n const poll = isString(messageOrOptions) ? {} : messageOrOptions || {};\n return configure({ _poll: poll })(actual, messageOrOptions) as any;\n };\n }\n return (expectLibrary as any)[property];\n },\n });\n\n const configure = (configuration: { message?: string, timeout?: number, soft?: boolean, _poll?: boolean | { timeout?: number, intervals?: number[] } }) => {\n const newInfo = { ...info };\n if ('message' in configuration)\n newInfo.message = configuration.message;\n if ('timeout' in configuration)\n newInfo.timeout = configuration.timeout;\n if ('soft' in configuration)\n newInfo.isSoft = configuration.soft;\n if ('_poll' in configuration) {\n newInfo.poll = configuration._poll ? { ...info.poll, generator: () => {} } : undefined;\n if (typeof configuration._poll === 'object') {\n newInfo.poll!.timeout = configuration._poll.timeout ?? newInfo.poll!.timeout;\n newInfo.poll!.intervals = configuration._poll.intervals ?? newInfo.poll!.intervals;\n }\n }\n return createExpect(newInfo, prefix, userMatchers);\n };\n\n return expectInstance;\n}\n\n// Expect wraps matchers, so there is no way to pass this information to the raw Playwright matcher.\n// Rely on sync call sequence to seed each matcher call with the context.\ntype MatcherCallContext = {\n expectInfo: ExpectMetaInfo;\n testInfo: TestInfoImpl | null;\n step?: TestStepInfoImpl;\n};\n\nlet matcherCallContext: MatcherCallContext | undefined;\n\nfunction setMatcherCallContext(context: MatcherCallContext) {\n matcherCallContext = context;\n}\n\nfunction takeMatcherCallContext(): MatcherCallContext | undefined {\n try {\n return matcherCallContext;\n } finally {\n // Any subsequent matcher following the first is assumed to be an unsupported legacy asymmetric matcher.\n // Lacking call context in these scenarios is not particularly important.\n matcherCallContext = undefined;\n }\n}\n\nconst defaultExpectTimeout = 5000;\n\nfunction wrapPlaywrightMatcherToPassNiceThis(matcher: any) {\n return function(this: any, ...args: any[]) {\n const { isNot, promise, utils } = this;\n const context = takeMatcherCallContext();\n const timeout = context?.expectInfo.timeout ?? context?.testInfo?._projectInternal?.expect?.timeout ?? defaultExpectTimeout;\n const newThis: ExpectMatcherStateInternal = {\n isNot,\n promise,\n utils,\n timeout,\n _stepInfo: context?.step,\n };\n (newThis as any).equals = throwUnsupportedExpectMatcherError;\n return matcher.call(newThis, ...args);\n };\n}\n\nfunction throwUnsupportedExpectMatcherError() {\n throw new Error('It looks like you are using custom expect matchers that are not compatible with Playwright. See https://aka.ms/playwright/expect-compatibility');\n}\n\nexpectLibrary.setState({ expand: false });\n\nconst customAsyncMatchers = {\n toBeAttached,\n toBeChecked,\n toBeDisabled,\n toBeEditable,\n toBeEmpty,\n toBeEnabled,\n toBeFocused,\n toBeHidden,\n toBeInViewport,\n toBeOK,\n toBeVisible,\n toContainText,\n toContainClass,\n toHaveAccessibleDescription,\n toHaveAccessibleName,\n toHaveAccessibleErrorMessage,\n toHaveAttribute,\n toHaveClass,\n toHaveCount,\n toHaveCSS,\n toHaveId,\n toHaveJSProperty,\n toHaveRole,\n toHaveText,\n toHaveTitle,\n toHaveURL,\n toHaveValue,\n toHaveValues,\n toHaveScreenshot,\n toMatchAriaSnapshot,\n toPass,\n};\n\nconst customMatchers = {\n ...customAsyncMatchers,\n toMatchSnapshot,\n};\n\ntype Generator = () => any;\n\ntype ExpectMetaInfo = {\n message?: string;\n isNot?: boolean;\n isSoft?: boolean;\n poll?: {\n timeout?: number;\n intervals?: number[];\n generator: Generator;\n };\n timeout?: number;\n};\n\nclass ExpectMetaInfoProxyHandler implements ProxyHandler<any> {\n private _actual: any;\n private _info: ExpectMetaInfo;\n private _prefix: string[];\n\n constructor(actual: any, info: ExpectMetaInfo, prefix: string[]) {\n this._actual = actual;\n this._info = { ...info };\n this._prefix = prefix;\n }\n\n get(target: Object, matcherName: string | symbol, receiver: any): any {\n if (matcherName === 'toThrowError')\n matcherName = 'toThrow';\n let matcher = Reflect.get(target, matcherName, receiver);\n if (typeof matcherName !== 'string')\n return matcher;\n\n let resolvedMatcherName = matcherName;\n for (let i = this._prefix.length; i > 0; i--) {\n const qualifiedName = qualifiedMatcherName(this._prefix.slice(0, i), matcherName);\n if (Reflect.has(target, qualifiedName)) {\n matcher = Reflect.get(target, qualifiedName, receiver);\n resolvedMatcherName = qualifiedName;\n break;\n }\n }\n\n if (matcher === undefined)\n throw new Error(`expect: Property '${matcherName}' not found.`);\n if (typeof matcher !== 'function') {\n if (matcherName === 'not')\n this._info.isNot = !this._info.isNot;\n return new Proxy(matcher, this);\n }\n if (this._info.poll) {\n if ((customAsyncMatchers as any)[matcherName] || matcherName === 'resolves' || matcherName === 'rejects')\n throw new Error(`\\`expect.poll()\\` does not support \"${matcherName}\" matcher.`);\n matcher = (...args: any[]) => pollMatcher(resolvedMatcherName, this._info, this._prefix, ...args);\n }\n return (...args: any[]) => {\n const testInfo = currentTestInfo();\n setMatcherCallContext({ expectInfo: this._info, testInfo });\n if (!testInfo)\n return matcher.call(target, ...args);\n\n const customMessage = this._info.message || '';\n const suffixes = computeMatcherTitleSuffix(matcherName, this._actual, args);\n const defaultTitle = `${this._info.poll ? 'poll ' : ''}${this._info.isSoft ? 'soft ' : ''}${this._info.isNot ? 'not ' : ''}${matcherName}${suffixes.short || ''}`;\n const shortTitle = customMessage || `Expect ${escapeWithQuotes(defaultTitle, '\"')}`;\n const longTitle = shortTitle + (suffixes.long || '');\n const apiName = `expect${this._info.poll ? '.poll ' : ''}${this._info.isSoft ? '.soft ' : ''}${this._info.isNot ? '.not' : ''}.${matcherName}${suffixes.short || ''}`;\n\n // This looks like it is unnecessary, but it isn't - we need to filter\n // out all the frames that belong to the test runner from caught runtime errors.\n const stackFrames = filteredStackTrace(captureRawStack());\n\n // toPass and poll matchers can contain other steps, expects and API calls,\n // so they behave like a retriable step.\n const stepInfo = {\n category: 'expect' as const,\n apiName,\n title: longTitle,\n shortTitle,\n params: args[0] ? { expected: args[0] } : undefined,\n infectParentStepsWithError: this._info.isSoft,\n };\n\n const step = testInfo._addStep(stepInfo);\n\n const reportStepError = (e: Error | unknown) => {\n const jestError = isJestError(e) ? e : null;\n const expectError = jestError ? new ExpectError(jestError, customMessage, stackFrames) : undefined;\n if (jestError?.matcherResult.suggestedRebaseline) {\n // NOTE: this is a workaround for the fact that we can't pass the suggested rebaseline\n // for passing matchers. See toMatchAriaSnapshot for a counterpart.\n step.complete({ suggestedRebaseline: jestError?.matcherResult.suggestedRebaseline });\n return;\n }\n\n const error = expectError ?? e;\n step.complete({ error });\n\n if (this._info.isSoft)\n testInfo._failWithError(error);\n else\n throw error;\n };\n\n const finalizer = () => {\n step.complete({});\n };\n\n try {\n setMatcherCallContext({ expectInfo: this._info, testInfo, step: step.info });\n const callback = () => matcher.call(target, ...args);\n const result = currentZone().with('stepZone', step).run(callback);\n if (result instanceof Promise)\n return result.then(finalizer).catch(reportStepError);\n finalizer();\n return result;\n } catch (e) {\n void reportStepError(e);\n }\n };\n }\n}\n\nasync function pollMatcher(qualifiedMatcherName: string, info: ExpectMetaInfo, prefix: string[], ...args: any[]) {\n const testInfo = currentTestInfo();\n const poll = info.poll!;\n const timeout = poll.timeout ?? info.timeout ?? testInfo?._projectInternal?.expect?.timeout ?? defaultExpectTimeout;\n const { deadline, timeoutMessage } = testInfo ? testInfo._deadlineForMatcher(timeout) : TestInfoImpl._defaultDeadlineForMatcher(timeout);\n\n const result = await pollAgainstDeadline<Error|undefined>(async () => {\n if (testInfo && currentTestInfo() !== testInfo)\n return { continuePolling: false, result: undefined };\n\n const innerInfo: ExpectMetaInfo = {\n ...info,\n isSoft: false, // soft is outside of poll, not inside\n poll: undefined,\n };\n const value = await poll.generator();\n try {\n let matchers = createMatchers(value, innerInfo, prefix);\n if (info.isNot)\n matchers = matchers.not;\n matchers[qualifiedMatcherName](...args);\n return { continuePolling: false, result: undefined };\n } catch (error) {\n return { continuePolling: true, result: error };\n }\n }, deadline, poll.intervals ?? [100, 250, 500, 1000]);\n\n if (result.timedOut) {\n const message = result.result ? [\n result.result.message,\n '',\n `Call Log:`,\n `- ${timeoutMessage}`,\n ].join('\\n') : timeoutMessage;\n\n throw new Error(message);\n }\n}\n\nexport const expect: Expect<{}> = createExpect({}, [], {}).extend(customMatchers);\n\nexport function mergeExpects(...expects: any[]) {\n let merged = expect;\n for (const e of expects) {\n const internals = e[userMatchersSymbol];\n if (!internals) // non-playwright expects mutate the global expect, so we don't need to do anything special\n continue;\n merged = merged.extend(internals);\n }\n return merged;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAM6B;AAE7B,yBAAyC;AACzC,sBA+BO;AACP,iCAAoC;AACpC,6BAAkD;AAClD,0BAKO;AACP,qBAAgC;AAChC,kBAAmC;AACnC,sBAA6B;AAkB7B,MAAM,iBAAiB,CAAC,QAAwB,IAAI,QAAQ,SAAS,MAAM;AAEpE,MAAM,8CAA8C,CACzD,UACA,OACA,eAEA;AAAA,EACI,MACA,eAAe,SAAS,MAAM,GAAG,KAAK,CAAC,QACvC,oCAAe,eAAe,SAAS,MAAM,OAAO,QAAQ,MAAM,CAAC,CAAC,IACpE,eAAe,SAAS,MAAM,QAAQ,MAAM,CAAC,IAC7C;AACJ;AAEK,MAAM,2CAA2C,CACtD,UACA,WAEA,WAAW,WACP,mCAAc,QAAQ,IACtB;AAAA,EACE;AAAA,EACA,OAAO;AAAA,EACP,OAAO,CAAC,EAAE;AACd;AAMJ,SAAS,eAAe,QAAiB,MAAsB,QAAuB;AACpF,SAAO,IAAI,UAAM,oBAAAA,QAAc,MAAM,GAAG,IAAI,2BAA2B,QAAQ,MAAM,MAAM,CAAC;AAC9F;AAEA,MAAM,qBAAqB,OAAO,cAAc;AAEhD,SAAS,qBAAqB,WAAqB,aAAqB;AACtE,SAAO,UAAU,KAAK,GAAG,IAAI,MAAM;AACrC;AAEA,SAAS,aAAa,MAAsB,QAAkB,cAAwC;AACpG,QAAM,iBAA6B,IAAI,MAAM,oBAAAA,QAAe;AAAA,IAC1D,OAAO,SAAS,QAAa,SAAc,eAA0C;AACnF,YAAM,CAAC,QAA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B,OAAO,QAAQ,OAAU;AAErD,UAAM,YAA4B;AAAA,MAChC,GAAG;AAAA,MACH,QAAQ;AAAA;AAAA,MACR,MAAM;AAAA,IACR;AACA,UAAM,QAAQ,MAAM,KAAK,UAAU;AACnC,QAAI;AACF,UAAI,WAAW,eAAe,OAAO,WAAW,MAAM;AACtD,UAAI,KAAK;AACP,mBAAW,SAAS;AACtB,eAASA,qBAAoB,EAAE,GAAG,IAAI;AACtC,aAAO,EAAE,iBAAiB,OAAO,QAAQ,OAAU;AAAA,IACrD,SAAS,OAAO;AACd,aAAO,EAAE,iBAAiB,MAAM,QAAQ,MAAM;AAAA,IAChD;AAAA,EACF,GAAG,UAAU,KAAK,aAAa,CAAC,KAAK,KAAK,KAAK,GAAI,CAAC;AAEpD,MAAI,OAAO,UAAU;AACnB,UAAM,UAAU,OAAO,SAAS;AAAA,MAC9B,OAAO,OAAO;AAAA,MACd;AAAA,MACA;AAAA,MACA,KAAK,cAAc;AAAA,IACrB,EAAE,KAAK,IAAI,IAAI;AAEf,UAAM,IAAI,MAAM,OAAO;AAAA,EACzB;AACF;AAEO,MAAM,SAAqB,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,cAAc;AAEzE,SAAS,gBAAgB,SAAgB;AAC9C,MAAI,SAAS;AACb,aAAW,KAAK,SAAS;AACvB,UAAM,YAAY,EAAE,kBAAkB;AACtC,QAAI,CAAC;AACH;AACF,aAAS,OAAO,OAAO,SAAS;AAAA,EAClC;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["expectLibrary", "qualifiedMatcherName"]
|
|
7
|
+
}
|
|
@@ -19,43 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var matcherHint_exports = {};
|
|
20
20
|
__export(matcherHint_exports, {
|
|
21
21
|
ExpectError: () => ExpectError,
|
|
22
|
-
callLogText: () => callLogText,
|
|
23
|
-
formatMatcherMessage: () => formatMatcherMessage,
|
|
24
22
|
isJestError: () => isJestError
|
|
25
23
|
});
|
|
26
24
|
module.exports = __toCommonJS(matcherHint_exports);
|
|
27
25
|
var import_utils = require("playwright-core/lib/utils");
|
|
28
|
-
var import_expectBundle = require("../common/expectBundle");
|
|
29
|
-
function formatMatcherMessage(state, details) {
|
|
30
|
-
const receiver = details.receiver ?? (details.locator ? "locator" : "page");
|
|
31
|
-
let message = (0, import_expectBundle.DIM_COLOR)("expect(") + (0, import_expectBundle.RECEIVED_COLOR)(receiver) + (0, import_expectBundle.DIM_COLOR)(")" + (state.promise ? "." + state.promise : "") + (state.isNot ? ".not" : "") + ".") + details.matcherName + (0, import_expectBundle.DIM_COLOR)("(") + (0, import_expectBundle.EXPECTED_COLOR)(details.expectation) + (0, import_expectBundle.DIM_COLOR)(")") + " failed\n\n";
|
|
32
|
-
const diffLines = details.printedDiff?.split("\n");
|
|
33
|
-
if (diffLines?.length === 2) {
|
|
34
|
-
details.printedExpected = diffLines[0];
|
|
35
|
-
details.printedReceived = diffLines[1];
|
|
36
|
-
details.printedDiff = void 0;
|
|
37
|
-
}
|
|
38
|
-
const align = !details.errorMessage && details.printedExpected?.startsWith("Expected:") && (!details.printedReceived || details.printedReceived.startsWith("Received:"));
|
|
39
|
-
if (details.locator)
|
|
40
|
-
message += `Locator: ${align ? " " : ""}${String(details.locator)}
|
|
41
|
-
`;
|
|
42
|
-
if (details.printedExpected)
|
|
43
|
-
message += details.printedExpected + "\n";
|
|
44
|
-
if (details.printedReceived)
|
|
45
|
-
message += details.printedReceived + "\n";
|
|
46
|
-
if (details.timedOut && details.timeout)
|
|
47
|
-
message += `Timeout: ${align ? " " : ""}${details.timeout}ms
|
|
48
|
-
`;
|
|
49
|
-
if (details.printedDiff)
|
|
50
|
-
message += details.printedDiff + "\n";
|
|
51
|
-
if (details.errorMessage) {
|
|
52
|
-
message += details.errorMessage;
|
|
53
|
-
if (!details.errorMessage.endsWith("\n"))
|
|
54
|
-
message += "\n";
|
|
55
|
-
}
|
|
56
|
-
message += callLogText(details.log);
|
|
57
|
-
return message;
|
|
58
|
-
}
|
|
59
26
|
class ExpectError extends Error {
|
|
60
27
|
constructor(jestError, customMessage, stackFrames) {
|
|
61
28
|
super("");
|
|
@@ -68,20 +35,10 @@ class ExpectError extends Error {
|
|
|
68
35
|
}
|
|
69
36
|
}
|
|
70
37
|
function isJestError(e) {
|
|
71
|
-
return e instanceof Error && "matcherResult" in e;
|
|
38
|
+
return e instanceof Error && "matcherResult" in e && !!e.matcherResult;
|
|
72
39
|
}
|
|
73
|
-
const callLogText = (log) => {
|
|
74
|
-
if (!log || !log.some((l) => !!l))
|
|
75
|
-
return "";
|
|
76
|
-
return `
|
|
77
|
-
Call log:
|
|
78
|
-
${(0, import_expectBundle.DIM_COLOR)(log.join("\n"))}
|
|
79
|
-
`;
|
|
80
|
-
};
|
|
81
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
41
|
0 && (module.exports = {
|
|
83
42
|
ExpectError,
|
|
84
|
-
callLogText,
|
|
85
|
-
formatMatcherMessage,
|
|
86
43
|
isJestError
|
|
87
44
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/matchers/matcherHint.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 { stringifyStackFrames } from 'playwright-core/lib/utils';\nimport { DIM_COLOR, RECEIVED_COLOR, EXPECTED_COLOR } from '../common/expectBundle';\n\nimport type { ExpectMatcherState } from '../../types/test';\nimport type { StackFrame } from '@protocol/channels';\nimport type { Locator } from 'playwright-core';\n\ntype MatcherMessageDetails = {\n receiver?: string; // Assuming 'locator' when locator is provided, 'page' otherwise.\n matcherName: string;\n expectation: string;\n locator?: Locator;\n printedExpected?: string;\n printedReceived?: string;\n printedDiff?: string;\n timedOut?: boolean;\n timeout?: number;\n errorMessage?: string;\n log?: string[];\n};\n\nexport function formatMatcherMessage(state: ExpectMatcherState, details: MatcherMessageDetails) {\n const receiver = details.receiver ?? (details.locator ? 'locator' : 'page');\n let message = DIM_COLOR('expect(') + RECEIVED_COLOR(receiver)\n + DIM_COLOR(')' + (state.promise ? '.' + state.promise : '') + (state.isNot ? '.not' : '') + '.')\n + details.matcherName\n + DIM_COLOR('(') + EXPECTED_COLOR(details.expectation) + DIM_COLOR(')')\n + ' failed\\n\\n';\n\n // Sometimes diff is actually expected + received. Turn it into two lines to\n // simplify alignment logic.\n const diffLines = details.printedDiff?.split('\\n');\n if (diffLines?.length === 2) {\n details.printedExpected = diffLines[0];\n details.printedReceived = diffLines[1];\n details.printedDiff = undefined;\n }\n\n const align = !details.errorMessage && details.printedExpected?.startsWith('Expected:')\n && (!details.printedReceived || details.printedReceived.startsWith('Received:'));\n if (details.locator)\n message += `Locator: ${align ? ' ' : ''}${String(details.locator)}\\n`;\n if (details.printedExpected)\n message += details.printedExpected + '\\n';\n if (details.printedReceived)\n message += details.printedReceived + '\\n';\n if (details.timedOut && details.timeout)\n message += `Timeout: ${align ? ' ' : ''}${details.timeout}ms\\n`;\n if (details.printedDiff)\n message += details.printedDiff + '\\n';\n if (details.errorMessage) {\n message += details.errorMessage;\n if (!details.errorMessage.endsWith('\\n'))\n message += '\\n';\n }\n message += callLogText(details.log);\n return message;\n}\n\nexport type MatcherResult<E, A> = {\n name: string;\n expected?: E;\n message: () => string;\n pass: boolean;\n actual?: A;\n log?: string[];\n timeout?: number;\n suggestedRebaseline?: string;\n};\n\nexport type MatcherResultProperty = Omit<MatcherResult<unknown, unknown>, 'message'> & {\n message: string;\n};\n\ntype JestError = Error & {\n matcherResult: MatcherResultProperty;\n};\n\nexport class ExpectError extends Error {\n matcherResult: MatcherResultProperty;\n\n constructor(jestError: JestError, customMessage: string, stackFrames: StackFrame[]) {\n super('');\n // Copy to erase the JestMatcherError constructor name from the console.log(error).\n this.name = jestError.name;\n this.message = jestError.message;\n this.matcherResult = jestError.matcherResult;\n\n if (customMessage)\n this.message = customMessage + '\\n\\n' + this.message;\n this.stack = this.name + ': ' + this.message + '\\n' + stringifyStackFrames(stackFrames).join('\\n');\n }\n}\n\nexport function isJestError(e: unknown): e is JestError {\n return e instanceof Error && 'matcherResult' in e;\n}\n\nexport const callLogText = (log: string[] | undefined) => {\n if (!log || !log.some(l => !!l))\n return '';\n return `\nCall log:\n${DIM_COLOR(log.join('\\n'))}\n`;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAAqC;AACrC,0BAA0D;AAoBnD,SAAS,qBAAqB,OAA2B,SAAgC;AAC9F,QAAM,WAAW,QAAQ,aAAa,QAAQ,UAAU,YAAY;AACpE,MAAI,cAAU,+BAAU,SAAS,QAAI,oCAAe,QAAQ,QACtD,+BAAU,OAAO,MAAM,UAAU,MAAM,MAAM,UAAU,OAAO,MAAM,QAAQ,SAAS,MAAM,GAAG,IAC9F,QAAQ,kBACR,+BAAU,GAAG,QAAI,oCAAe,QAAQ,WAAW,QAAI,+BAAU,GAAG,IACpE;AAIN,QAAM,YAAY,QAAQ,aAAa,MAAM,IAAI;AACjD,MAAI,WAAW,WAAW,GAAG;AAC3B,YAAQ,kBAAkB,UAAU,CAAC;AACrC,YAAQ,kBAAkB,UAAU,CAAC;AACrC,YAAQ,cAAc;AAAA,EACxB;AAEA,QAAM,QAAQ,CAAC,QAAQ,gBAAgB,QAAQ,iBAAiB,WAAW,WAAW,MAC9E,CAAC,QAAQ,mBAAmB,QAAQ,gBAAgB,WAAW,WAAW;AAClF,MAAI,QAAQ;AACV,eAAW,YAAY,QAAQ,MAAM,EAAE,GAAG,OAAO,QAAQ,OAAO,CAAC;AAAA;AACnE,MAAI,QAAQ;AACV,eAAW,QAAQ,kBAAkB;AACvC,MAAI,QAAQ;AACV,eAAW,QAAQ,kBAAkB;AACvC,MAAI,QAAQ,YAAY,QAAQ;AAC9B,eAAW,YAAY,QAAQ,MAAM,EAAE,GAAG,QAAQ,OAAO;AAAA;AAC3D,MAAI,QAAQ;AACV,eAAW,QAAQ,cAAc;AACnC,MAAI,QAAQ,cAAc;AACxB,eAAW,QAAQ;AACnB,QAAI,CAAC,QAAQ,aAAa,SAAS,IAAI;AACrC,iBAAW;AAAA,EACf;AACA,aAAW,YAAY,QAAQ,GAAG;AAClC,SAAO;AACT;AAqBO,MAAM,oBAAoB,MAAM;AAAA,EAGrC,YAAY,WAAsB,eAAuB,aAA2B;AAClF,UAAM,EAAE;AAER,SAAK,OAAO,UAAU;AACtB,SAAK,UAAU,UAAU;AACzB,SAAK,gBAAgB,UAAU;AAE/B,QAAI;AACF,WAAK,UAAU,gBAAgB,SAAS,KAAK;AAC/C,SAAK,QAAQ,KAAK,OAAO,OAAO,KAAK,UAAU,WAAO,mCAAqB,WAAW,EAAE,KAAK,IAAI;AAAA,EACnG;AACF;AAEO,SAAS,YAAY,GAA4B;AACtD,SAAO,aAAa,SAAS,mBAAmB;AAClD;AAEO,MAAM,cAAc,CAAC,QAA8B;AACxD,MAAI,CAAC,OAAO,CAAC,IAAI,KAAK,OAAK,CAAC,CAAC,CAAC;AAC5B,WAAO;AACT,SAAO;AAAA;AAAA,MAEP,+BAAU,IAAI,KAAK,IAAI,CAAC,CAAC;AAAA;AAE3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/matchers/matchers.js
CHANGED
|
@@ -61,7 +61,6 @@ var import_toMatchSnapshot = require("./toMatchSnapshot");
|
|
|
61
61
|
var import_config = require("../common/config");
|
|
62
62
|
var import_globals = require("../common/globals");
|
|
63
63
|
var import_testInfo = require("../worker/testInfo");
|
|
64
|
-
var import_matcherHint = require("./matcherHint");
|
|
65
64
|
function toBeAttached(locator, options) {
|
|
66
65
|
const attached = !options || options.attached === void 0 || options.attached;
|
|
67
66
|
const expected = attached ? "attached" : "detached";
|
|
@@ -297,7 +296,9 @@ async function toBeOK(response) {
|
|
|
297
296
|
response._fetchLog(),
|
|
298
297
|
isTextEncoding ? response.text() : null
|
|
299
298
|
]) : [];
|
|
300
|
-
const message = () => (0,
|
|
299
|
+
const message = () => (0, import_utils.formatMatcherMessage)(this.utils, {
|
|
300
|
+
isNot: this.isNot,
|
|
301
|
+
promise: this.promise,
|
|
301
302
|
matcherName,
|
|
302
303
|
receiver: "response",
|
|
303
304
|
expectation: "",
|