From ad0f9b6f45951b8afcbe26dfd5d3f4e9cbe45c72 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 5 Aug 2024 12:48:23 +0200 Subject: [PATCH] use re-exporting technique --- tests/android/device.spec.ts | 2 +- tests/config/browserTest.ts | 2 +- tests/config/comparator.ts | 3 +- tests/config/serverFixtures.ts | 2 +- tests/config/testserver/index.ts | 2 +- tests/config/utils.ts | 4 +- tests/electron/globalSetup.ts | 2 +- tests/global.d.ts | 39 ------------------- tests/image_tools/fixtures.spec.ts | 2 +- tests/image_tools/utils.ts | 2 +- tests/installation/globalSetup.ts | 2 +- tests/installation/npmTest.ts | 2 +- tests/installation/registry.ts | 2 +- tests/library/browsertype-connect.spec.ts | 4 +- .../library/chromium/connect-over-cdp.spec.ts | 2 +- tests/library/client-certificates.spec.ts | 2 +- tests/library/component-parser.spec.ts | 4 +- tests/library/css-parser.spec.ts | 2 +- tests/library/debug-controller.spec.ts | 2 +- .../events/check-listener-leaks.spec.ts | 2 +- tests/library/global-fetch.spec.ts | 2 +- tests/library/har.spec.ts | 2 +- tests/library/headful.spec.ts | 2 +- tests/library/locator-generator.spec.ts | 4 +- tests/library/screenshot.spec.ts | 2 +- tests/library/tracing.spec.ts | 2 +- tests/library/video.spec.ts | 4 +- tests/page/interception.spec.ts | 2 +- tests/page/page-leaks.spec.ts | 2 +- tests/playwright-test/expect.spec.ts | 2 +- .../playwright-test-fixtures.ts | 2 +- tests/playwright-test/reporter-blob.spec.ts | 2 +- tests/playwright-test/reporter-html.spec.ts | 2 +- .../to-have-screenshot.spec.ts | 2 +- .../ui-mode-test-progress.spec.ts | 2 +- tests/playwright-test/watch.spec.ts | 1 + tests/playwright-test/web-server.spec.ts | 2 +- tests/tsconfig.json | 3 +- .../playwright-core/cssParser.d.ts | 17 ++++++++ .../playwright-core/cssParser.js | 17 ++++++++ .../playwright-core/locatorGenerators.d.ts | 17 ++++++++ .../playwright-core/locatorGenerators.js | 17 ++++++++ .../playwright-core/locatorParser.d.ts | 17 ++++++++ .../playwright-core/locatorParser.js | 17 ++++++++ .../playwright-core/selectorParser.d.ts | 17 ++++++++ .../playwright-core/selectorParser.js | 17 ++++++++ .../playwright-core/socksProxy.d.ts | 17 ++++++++ .../playwright-core/socksProxy.js | 17 ++++++++ .../playwright-core/traceUtils.d.ts | 17 ++++++++ .../playwright-core/traceUtils.js | 17 ++++++++ .../typed-imports/playwright-core/utils.d.ts | 17 ++++++++ tests/typed-imports/playwright-core/utils.js | 17 ++++++++ .../playwright-core/utilsBundle.d.ts | 17 ++++++++ .../playwright-core/utilsBundle.js | 17 ++++++++ 54 files changed, 314 insertions(+), 82 deletions(-) delete mode 100644 tests/global.d.ts create mode 100644 tests/typed-imports/playwright-core/cssParser.d.ts create mode 100644 tests/typed-imports/playwright-core/cssParser.js create mode 100644 tests/typed-imports/playwright-core/locatorGenerators.d.ts create mode 100644 tests/typed-imports/playwright-core/locatorGenerators.js create mode 100644 tests/typed-imports/playwright-core/locatorParser.d.ts create mode 100644 tests/typed-imports/playwright-core/locatorParser.js create mode 100644 tests/typed-imports/playwright-core/selectorParser.d.ts create mode 100644 tests/typed-imports/playwright-core/selectorParser.js create mode 100644 tests/typed-imports/playwright-core/socksProxy.d.ts create mode 100644 tests/typed-imports/playwright-core/socksProxy.js create mode 100644 tests/typed-imports/playwright-core/traceUtils.d.ts create mode 100644 tests/typed-imports/playwright-core/traceUtils.js create mode 100644 tests/typed-imports/playwright-core/utils.d.ts create mode 100644 tests/typed-imports/playwright-core/utils.js create mode 100644 tests/typed-imports/playwright-core/utilsBundle.d.ts create mode 100644 tests/typed-imports/playwright-core/utilsBundle.js diff --git a/tests/android/device.spec.ts b/tests/android/device.spec.ts index 953d9fed4a..3c77c17366 100644 --- a/tests/android/device.spec.ts +++ b/tests/android/device.spec.ts @@ -16,7 +16,7 @@ import fs from 'fs'; import { join } from 'path'; -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import { androidTest as test, expect } from './androidTest'; diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index bf26e05b5a..780fca4f97 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -19,7 +19,7 @@ import * as os from 'os'; import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi'; import * as path from 'path'; import type { BrowserContext, BrowserContextOptions, BrowserType, Page } from 'playwright-core'; -import { removeFolders } from '@playwright-core/utils'; +import { removeFolders } from '../typed-imports/playwright-core/utils'; import { baseTest } from './baseTest'; import { type RemoteServerOptions, type PlaywrightServer, RunServer, RemoteServer } from './remoteServer'; import type { Log } from '../../packages/trace/src/har'; diff --git a/tests/config/comparator.ts b/tests/config/comparator.ts index a271a07caf..dd3ecc1f65 100644 --- a/tests/config/comparator.ts +++ b/tests/config/comparator.ts @@ -14,8 +14,7 @@ * limitations under the License. */ -import { getComparator } from '@playwright-core/utils'; - +import { getComparator } from '../typed-imports/playwright-core/utils'; const pngComparator = getComparator('image/png'); type ComparatorResult = { diff?: Buffer; errorMessage: string; } | null; type ImageComparatorOptions = { threshold?: number, maxDiffPixels?: number, maxDiffPixelRatio?: number }; diff --git a/tests/config/serverFixtures.ts b/tests/config/serverFixtures.ts index e1abf528ed..576fcfdfab 100644 --- a/tests/config/serverFixtures.ts +++ b/tests/config/serverFixtures.ts @@ -20,7 +20,7 @@ import { TestServer } from './testserver'; import { TestProxy } from './proxy'; import type { SocksSocketRequestedPayload } from '../../packages/playwright-core/src/common/socksProxy'; -import { SocksProxy } from '@playwright-core/common/socksProxy'; +import { SocksProxy } from '../typed-imports/playwright-core/socksProxy'; export type ServerWorkerOptions = { loopback?: string; diff --git a/tests/config/testserver/index.ts b/tests/config/testserver/index.ts index d627b5a478..ce7ae7dd36 100644 --- a/tests/config/testserver/index.ts +++ b/tests/config/testserver/index.ts @@ -24,7 +24,7 @@ import url from 'url'; import util from 'util'; import ws from 'ws'; import zlib, { gzip } from 'zlib'; -import { createHttpServer, createHttpsServer } from '@playwright-core/utils'; +import { createHttpServer, createHttpsServer } from '../../typed-imports/playwright-core/utils'; const fulfillSymbol = Symbol('fulfil callback'); const rejectSymbol = Symbol('reject callback'); diff --git a/tests/config/utils.ts b/tests/config/utils.ts index c274ef0522..6317f125a7 100644 --- a/tests/config/utils.ts +++ b/tests/config/utils.ts @@ -15,10 +15,10 @@ */ import type { Frame, Page } from 'playwright-core'; -import { ZipFile } from '@playwright-core/utils'; +import { ZipFile } from '../typed-imports/playwright-core/utils'; import type { TraceModelBackend } from '../../packages/trace-viewer/src/traceModel'; import type { StackFrame } from '../../packages/protocol/src/channels'; -import { parseClientSideCallMetadata } from '@playwright-core/utils/isomorphic/traceUtils'; +import { parseClientSideCallMetadata } from '../typed-imports/playwright-core/traceUtils'; import { TraceModel } from '../../packages/trace-viewer/src/traceModel'; import type { ActionTreeItem } from '../../packages/trace-viewer/src/ui/modelUtil'; import { buildActionTree, MultiTraceModel } from '../../packages/trace-viewer/src/ui/modelUtil'; diff --git a/tests/electron/globalSetup.ts b/tests/electron/globalSetup.ts index 7313369bd9..1f9f83ba81 100644 --- a/tests/electron/globalSetup.ts +++ b/tests/electron/globalSetup.ts @@ -15,7 +15,7 @@ */ import assert from 'assert'; -import { spawnAsync } from '@playwright-core/utils'; +import { spawnAsync } from '../typed-imports/playwright-core/utils'; export default async () => { const result = await spawnAsync('npx', ['electron', require.resolve('./electron-print-chromium-version.js'), '--no-sandbox'], { diff --git a/tests/global.d.ts b/tests/global.d.ts deleted file mode 100644 index a2a9df03e5..0000000000 --- a/tests/global.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -declare module '@playwright-core/utils' { - const content: typeof import('../packages/playwright-core/src/utils'); - export = content; -} - -declare module '@playwright-core/utilsBundle' { - const content: typeof import('../packages/playwright-core/src/utilsBundle'); - export = content; -} - -declare module '@playwright-core/common/socksProxy' { - const content: typeof import('../packages/playwright-core/src/common/socksProxy'); - export = content; -} - -declare module '@playwright-core/utils/isomorphic/traceUtils' { - const content: typeof import('../packages/playwright-core/src/utils/isomorphic/traceUtils'); - export = content; -} - -declare module '@playwright-core/utils/isomorphic/locatorGenerators' { - const content: typeof import('../packages/playwright-core/src/utils/isomorphic/locatorGenerators'); - export = content; -} - -declare module '@playwright-core/utils/isomorphic/locatorParser' { - const content: typeof import('../packages/playwright-core/src/utils/isomorphic/locatorParser'); - export = content; -} - -declare module '@playwright-core/utils/isomorphic/cssParser' { - const content: typeof import('../packages/playwright-core/src/utils/isomorphic/cssParser'); - export = content; -} - -declare module '@playwright-core/utils/isomorphic/selectorParser' { - const content: typeof import('../packages/playwright-core/src/utils/isomorphic/selectorParser'); - export = content; -} \ No newline at end of file diff --git a/tests/image_tools/fixtures.spec.ts b/tests/image_tools/fixtures.spec.ts index 73956ef7a0..792b0a5d89 100644 --- a/tests/image_tools/fixtures.spec.ts +++ b/tests/image_tools/fixtures.spec.ts @@ -15,7 +15,7 @@ */ import { test, expect } from '../playwright-test/stable-test-runner'; -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import { compare } from 'playwright-core/lib/image_tools/compare'; import fs from 'fs'; import path from 'path'; diff --git a/tests/image_tools/utils.ts b/tests/image_tools/utils.ts index 31d7a39055..d86b32183d 100644 --- a/tests/image_tools/utils.ts +++ b/tests/image_tools/utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import { ImageChannel } from 'playwright-core/lib/image_tools/imageChannel'; // mulberry32 diff --git a/tests/installation/globalSetup.ts b/tests/installation/globalSetup.ts index e2bcdc5325..dae79abd56 100644 --- a/tests/installation/globalSetup.ts +++ b/tests/installation/globalSetup.ts @@ -16,7 +16,7 @@ import path from 'path'; import fs from 'fs'; -import { spawnAsync, removeFolders } from '@playwright-core/utils'; +import { spawnAsync, removeFolders } from '../typed-imports/playwright-core/utils'; import { TMP_WORKSPACES } from './npmTest'; const PACKAGE_BUILDER_SCRIPT = path.join(__dirname, '..', '..', 'utils', 'pack_package.js'); diff --git a/tests/installation/npmTest.ts b/tests/installation/npmTest.ts index 0f7895d893..f5b93710c8 100644 --- a/tests/installation/npmTest.ts +++ b/tests/installation/npmTest.ts @@ -22,7 +22,7 @@ import debugLogger from 'debug'; import { Registry } from './registry'; import type { CommonFixtures, CommonWorkerFixtures } from '../config/commonFixtures'; import { commonFixtures } from '../config/commonFixtures'; -import { spawnAsync, removeFolders } from '@playwright-core/utils'; +import { spawnAsync, removeFolders } from '../typed-imports/playwright-core/utils'; import type { SpawnOptions } from 'child_process'; export const TMP_WORKSPACES = path.join(os.platform() === 'darwin' ? '/tmp' : os.tmpdir(), 'pwt', 'workspaces'); diff --git a/tests/installation/registry.ts b/tests/installation/registry.ts index 97ac512cef..49b73038bf 100644 --- a/tests/installation/registry.ts +++ b/tests/installation/registry.ts @@ -19,7 +19,7 @@ import type { Server } from 'http'; import type http from 'http'; import https from 'https'; import path from 'path'; -import { spawnAsync, createHttpServer } from '@playwright-core/utils'; +import { spawnAsync, createHttpServer } from '../typed-imports/playwright-core/utils'; const kPublicNpmRegistry = 'https://registry.npmjs.org'; const kContentTypeAbbreviatedMetadata = 'application/vnd.npm.install-v1+json'; diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.ts index b018b96ad3..8fa4305abc 100644 --- a/tests/library/browsertype-connect.spec.ts +++ b/tests/library/browsertype-connect.spec.ts @@ -20,13 +20,13 @@ import os from 'os'; import type http from 'http'; import type net from 'net'; import * as path from 'path'; -import { getUserAgent, getPlaywrightVersion } from '@playwright-core/utils'; +import { getUserAgent, getPlaywrightVersion } from '../typed-imports/playwright-core/utils'; import WebSocket from 'ws'; import { expect, playwrightTest } from '../config/browserTest'; import { parseTrace, suppressCertificateWarning } from '../config/utils'; import formidable from 'formidable'; import type { Browser, ConnectOptions } from 'playwright-core'; -import { createHttpServer } from '@playwright-core/utils'; +import { createHttpServer } from '../typed-imports/playwright-core/utils'; import { kTargetClosedErrorMessage } from '../config/errors'; import { RunServer } from '../config/remoteServer'; diff --git a/tests/library/chromium/connect-over-cdp.spec.ts b/tests/library/chromium/connect-over-cdp.spec.ts index 1cc372ab2c..70bb2e75b0 100644 --- a/tests/library/chromium/connect-over-cdp.spec.ts +++ b/tests/library/chromium/connect-over-cdp.spec.ts @@ -18,7 +18,7 @@ import { playwrightTest as test, expect } from '../../config/browserTest'; import http from 'http'; import fs from 'fs'; -import { getUserAgent } from '@playwright-core/utils'; +import { getUserAgent } from '../../typed-imports/playwright-core/utils'; import { suppressCertificateWarning } from '../../config/utils'; test.skip(({ mode }) => mode === 'service2'); diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts index 996d8c7224..9fdec236ad 100644 --- a/tests/library/client-certificates.spec.ts +++ b/tests/library/client-certificates.spec.ts @@ -20,7 +20,7 @@ import type http from 'http'; import { expect, playwrightTest as base } from '../config/browserTest'; import type net from 'net'; import type { BrowserContextOptions } from 'packages/playwright-test'; -import { createHttpsServer, createHttp2Server } from '@playwright-core/utils'; +import { createHttpsServer, createHttp2Server } from '../typed-imports/playwright-core/utils'; type TestOptions = { startCCServer(options?: { diff --git a/tests/library/component-parser.spec.ts b/tests/library/component-parser.spec.ts index 0dcd3bf620..970d53467a 100644 --- a/tests/library/component-parser.spec.ts +++ b/tests/library/component-parser.spec.ts @@ -15,8 +15,8 @@ */ import { playwrightTest as it, expect } from '../config/browserTest'; -import type { AttributeSelector } from '../../packages/playwright-core/src/utils/isomorphic/selectorParser'; -import { parseAttributeSelector } from '@playwright-core/utils/isomorphic/selectorParser'; +import type { AttributeSelector } from '../../packages/playwright-core/src/selectorParser'; +import { parseAttributeSelector } from '../typed-imports/playwright-core/selectorParser'; const parse = (selector: string) => parseAttributeSelector(selector, false); const serialize = (parsed: AttributeSelector) => { diff --git a/tests/library/css-parser.spec.ts b/tests/library/css-parser.spec.ts index 0ba31f777d..19b6ab5d0a 100644 --- a/tests/library/css-parser.spec.ts +++ b/tests/library/css-parser.spec.ts @@ -15,7 +15,7 @@ */ import { playwrightTest as it, expect } from '../config/browserTest'; -import { parseCSS, serializeSelector as serialize } from '@playwright-core/utils/isomorphic/cssParser'; +import { parseCSS, serializeSelector as serialize } from '../typed-imports/playwright-core/cssParser'; const parse = (selector: string) => { return parseCSS(selector, new Set(['text', 'not', 'has', 'react', 'scope', 'right-of', 'is'])).selector; diff --git a/tests/library/debug-controller.spec.ts b/tests/library/debug-controller.spec.ts index 287d2c0109..8b55158146 100644 --- a/tests/library/debug-controller.spec.ts +++ b/tests/library/debug-controller.spec.ts @@ -16,7 +16,7 @@ import { expect, playwrightTest as baseTest } from '../config/browserTest'; import { PlaywrightServer } from '../../packages/playwright-core/lib/remote/playwrightServer'; -import { createGuid } from '@playwright-core/utils'; +import { createGuid } from '../typed-imports/playwright-core/utils'; import { Backend } from '../config/debugControllerBackend'; import type { Browser, BrowserContext } from '@playwright/test'; import type * as channels from '@protocol/channels'; diff --git a/tests/library/events/check-listener-leaks.spec.ts b/tests/library/events/check-listener-leaks.spec.ts index fb0c81dd6b..6aaf48e6df 100644 --- a/tests/library/events/check-listener-leaks.spec.ts +++ b/tests/library/events/check-listener-leaks.spec.ts @@ -22,7 +22,7 @@ import events from 'events'; import { EventEmitter } from '../../../packages/playwright-core/lib/client/eventEmitter'; -import { setUnderTest } from '@playwright-core/utils'; +import { setUnderTest } from '../../typed-imports/playwright-core/utils'; import { test, expect } from '@playwright/test'; import * as common from './utils'; diff --git a/tests/library/global-fetch.spec.ts b/tests/library/global-fetch.spec.ts index 86cd721c24..8495690a16 100644 --- a/tests/library/global-fetch.spec.ts +++ b/tests/library/global-fetch.spec.ts @@ -16,7 +16,7 @@ import os from 'os'; import util from 'util'; -import { getPlaywrightVersion } from '@playwright-core/utils'; +import { getPlaywrightVersion } from '../typed-imports/playwright-core/utils'; import { expect, playwrightTest as base } from '../config/browserTest'; import { kTargetClosedErrorMessage } from 'tests/config/errors'; diff --git a/tests/library/har.spec.ts b/tests/library/har.spec.ts index b56c72a211..3bb60a48c6 100644 --- a/tests/library/har.spec.ts +++ b/tests/library/har.spec.ts @@ -22,7 +22,7 @@ import type { BrowserContext, BrowserContextOptions } from 'playwright-core'; import type { AddressInfo } from 'net'; import type { Log } from '../../packages/trace/src/har'; import { parseHar } from '../config/utils'; -import { createHttp2Server } from '@playwright-core/utils'; +import { createHttp2Server } from '../typed-imports/playwright-core/utils'; async function pageWithHar(contextFactory: (options?: BrowserContextOptions) => Promise, testInfo: any, options: { outputPath?: string, content?: 'embed' | 'attach' | 'omit', omitContent?: boolean } = {}) { const harPath = testInfo.outputPath(options.outputPath || 'test.har'); diff --git a/tests/library/headful.spec.ts b/tests/library/headful.spec.ts index 6b12f14c5b..ec68f2206d 100644 --- a/tests/library/headful.spec.ts +++ b/tests/library/headful.spec.ts @@ -15,7 +15,7 @@ */ import { compare } from 'playwright-core/lib/image_tools/compare'; -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import { expect, playwrightTest as it } from '../config/browserTest'; it.use({ headless: false }); diff --git a/tests/library/locator-generator.spec.ts b/tests/library/locator-generator.spec.ts index 2712c4f2d1..7368dd3e89 100644 --- a/tests/library/locator-generator.spec.ts +++ b/tests/library/locator-generator.spec.ts @@ -15,8 +15,8 @@ */ import { contextTest as it, expect } from '../config/browserTest'; -import { asLocator, asLocators } from '@playwright-core/utils/isomorphic/locatorGenerators'; -import { locatorOrSelectorAsSelector as parseLocator } from '@playwright-core/utils/isomorphic/locatorParser'; +import { asLocator, asLocators } from '../typed-imports/playwright-core/locatorGenerators'; +import { locatorOrSelectorAsSelector as parseLocator } from '../typed-imports/playwright-core/locatorParser'; import type { Page, Frame, Locator, FrameLocator } from 'playwright-core'; it.skip(({ mode }) => mode !== 'default'); diff --git a/tests/library/screenshot.spec.ts b/tests/library/screenshot.spec.ts index 6b14102532..6e7b4db6ad 100644 --- a/tests/library/screenshot.spec.ts +++ b/tests/library/screenshot.spec.ts @@ -16,7 +16,7 @@ */ import { expect, browserTest } from '../config/browserTest'; -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import { verifyViewport } from '../config/utils'; browserTest.describe('page screenshot', () => { diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.ts index 1173bdae5c..2224a998fc 100644 --- a/tests/library/tracing.spec.ts +++ b/tests/library/tracing.spec.ts @@ -15,7 +15,7 @@ */ import fs from 'fs'; -import { jpegjs } from '@playwright-core/utilsBundle'; +import { jpegjs } from '../typed-imports/playwright-core/utilsBundle'; import path from 'path'; import { browserTest, contextTest as test, expect } from '../config/browserTest'; import { parseTraceRaw } from '../config/utils'; diff --git a/tests/library/video.spec.ts b/tests/library/video.spec.ts index 38ca020cc8..26a8dde514 100644 --- a/tests/library/video.spec.ts +++ b/tests/library/video.spec.ts @@ -19,9 +19,9 @@ import fs from 'fs'; import path from 'path'; import type { Page } from 'playwright-core'; import { spawnSync } from 'child_process'; -import { PNG, jpegjs } from '@playwright-core/utilsBundle'; +import { PNG, jpegjs } from '../typed-imports/playwright-core/utilsBundle'; import { registry } from '../../packages/playwright-core/lib/server'; -import { rewriteErrorMessage } from '@playwright-core/utils'; +import { rewriteErrorMessage } from '../typed-imports/playwright-core/utils'; import { parseTraceRaw } from '../config/utils'; const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath('javascript'); diff --git a/tests/page/interception.spec.ts b/tests/page/interception.spec.ts index 5d935191d9..016fbd47cd 100644 --- a/tests/page/interception.spec.ts +++ b/tests/page/interception.spec.ts @@ -16,7 +16,7 @@ */ import { test as it, expect } from './pageTest'; -import { globToRegex } from '@playwright-core/utils'; +import { globToRegex } from '../typed-imports/playwright-core/utils'; import vm from 'vm'; it('should work with navigation @smoke', async ({ page, server }) => { diff --git a/tests/page/page-leaks.spec.ts b/tests/page/page-leaks.spec.ts index 3b2bc0642a..10662d2a9b 100644 --- a/tests/page/page-leaks.spec.ts +++ b/tests/page/page-leaks.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { MultiMap } from '@playwright-core/utils'; +import { MultiMap } from '../typed-imports/playwright-core/utils'; import { test, expect } from './pageTest'; function leakedJSHandles(): string { diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.ts index 728b7415cb..1da7c3723b 100644 --- a/tests/playwright-test/expect.spec.ts +++ b/tests/playwright-test/expect.spec.ts @@ -16,7 +16,7 @@ import path from 'path'; import { test, expect, parseTestRunnerOutput, stripAnsi } from './playwright-test-fixtures'; -import { spawnAsync } from '@playwright-core/utils'; +import { spawnAsync } from '../typed-imports/playwright-core/utils'; test('should be able to call expect.extend in config', async ({ runInlineTest }) => { const result = await runInlineTest({ diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts index a2393a7917..ec600f01a2 100644 --- a/tests/playwright-test/playwright-test-fixtures.ts +++ b/tests/playwright-test/playwright-test-fixtures.ts @@ -18,7 +18,7 @@ import type { JSONReport, JSONReportSpec, JSONReportSuite, JSONReportTest, JSONR import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import type { CommonFixtures, CommonWorkerFixtures, TestChildProcess } from '../config/commonFixtures'; import { commonFixtures } from '../config/commonFixtures'; import type { ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures'; diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts index 78adb5dbdd..a3c5983c0a 100644 --- a/tests/playwright-test/reporter-blob.spec.ts +++ b/tests/playwright-test/reporter-blob.spec.ts @@ -23,7 +23,7 @@ import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/h import { expect as baseExpect, test as baseTest, stripAnsi } from './playwright-test-fixtures'; import extractZip from '../../packages/playwright-core/bundles/zip/node_modules/extract-zip'; import * as yazl from '../../packages/playwright-core/bundles/zip/node_modules/yazl'; -import { getUserAgent } from '@playwright-core/utils'; +import { getUserAgent } from '../typed-imports/playwright-core/utils'; import { Readable } from 'stream'; const DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === 'win32' && process.env.TERM_PROGRAM !== 'vscode' && !process.env.WT_SESSION; diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts index e4c2591245..f35dd06696 100644 --- a/tests/playwright-test/reporter-html.spec.ts +++ b/tests/playwright-test/reporter-html.spec.ts @@ -21,7 +21,7 @@ import { test as baseTest, expect as baseExpect, createImage } from './playwrigh import type { HttpServer } from '../../packages/playwright-core/src/utils'; import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/html'; import { msToString } from '../../packages/web/src/uiUtils'; -import { spawnAsync } from '@playwright-core/utils'; +import { spawnAsync } from '../typed-imports/playwright-core/utils'; const test = baseTest.extend<{ showReport: (reportFolder?: string) => Promise }>({ showReport: async ({ page }, use, testInfo) => { diff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.ts index 5b3cd7b40e..fda861dd2e 100644 --- a/tests/playwright-test/to-have-screenshot.spec.ts +++ b/tests/playwright-test/to-have-screenshot.spec.ts @@ -15,7 +15,7 @@ */ import * as fs from 'fs'; -import { PNG } from '@playwright-core/utilsBundle'; +import { PNG } from '../typed-imports/playwright-core/utilsBundle'; import * as path from 'path'; import { pathToFileURL } from 'url'; import { test, expect, createImage, paintBlackPixels } from './playwright-test-fixtures'; diff --git a/tests/playwright-test/ui-mode-test-progress.spec.ts b/tests/playwright-test/ui-mode-test-progress.spec.ts index 2e5bb89d71..3118fa0918 100644 --- a/tests/playwright-test/ui-mode-test-progress.spec.ts +++ b/tests/playwright-test/ui-mode-test-progress.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ManualPromise } from '@playwright-core/utils'; +import { ManualPromise } from '../typed-imports/playwright-core/utils'; import { test, expect, retries, dumpTestTree } from './ui-mode-fixtures'; test.describe.configure({ mode: 'parallel', retries }); diff --git a/tests/playwright-test/watch.spec.ts b/tests/playwright-test/watch.spec.ts index 181fdd4177..0a46d8c40c 100644 --- a/tests/playwright-test/watch.spec.ts +++ b/tests/playwright-test/watch.spec.ts @@ -40,6 +40,7 @@ test('should print dependencies in CJS mode', async ({ runInlineTest }) => { test('passes', () => {}); `, 'globalTeardown.ts': ` + import path from 'path'; const { fileDependencies } = require(path.join(path.dirname(require.resolve('playwright')), 'lib/internalsForTest.js')); export default () => { console.log('###' + JSON.stringify(fileDependencies()) + '###'); diff --git a/tests/playwright-test/web-server.spec.ts b/tests/playwright-test/web-server.spec.ts index 3da551b4ca..4ef9635fa1 100644 --- a/tests/playwright-test/web-server.spec.ts +++ b/tests/playwright-test/web-server.spec.ts @@ -17,7 +17,7 @@ import type http from 'http'; import path from 'path'; import { test, expect, parseTestRunnerOutput } from './playwright-test-fixtures'; -import { createHttpServer } from '@playwright-core/utils'; +import { createHttpServer } from '../typed-imports/playwright-core/utils'; const SIMPLE_SERVER_PATH = path.join(__dirname, 'assets', 'simple-server.js'); diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 63e3038532..1a1e3d7527 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -16,9 +16,8 @@ "@recorder/*": ["packages/recorder/src/*"], "@trace/*": ["packages/trace/src/*"], "@web/*": ["packages/web/src/*"], - "@playwright-core/*": ["packages/playwright-core/lib/*"], }, }, - "include": ["**/*.spec.js", "**/*.ts", "global.d.ts"], + "include": ["**/*.spec.js", "**/*.ts"], "exclude": ["components/", "installation/fixture-scripts/"] } diff --git a/tests/typed-imports/playwright-core/cssParser.d.ts b/tests/typed-imports/playwright-core/cssParser.d.ts new file mode 100644 index 0000000000..012716a1bd --- /dev/null +++ b/tests/typed-imports/playwright-core/cssParser.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/utils/isomorphic/cssParser'; diff --git a/tests/typed-imports/playwright-core/cssParser.js b/tests/typed-imports/playwright-core/cssParser.js new file mode 100644 index 0000000000..9c0f6e5474 --- /dev/null +++ b/tests/typed-imports/playwright-core/cssParser.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/cssParser'); diff --git a/tests/typed-imports/playwright-core/locatorGenerators.d.ts b/tests/typed-imports/playwright-core/locatorGenerators.d.ts new file mode 100644 index 0000000000..c30296f805 --- /dev/null +++ b/tests/typed-imports/playwright-core/locatorGenerators.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/utils/isomorphic/locatorGenerators'; diff --git a/tests/typed-imports/playwright-core/locatorGenerators.js b/tests/typed-imports/playwright-core/locatorGenerators.js new file mode 100644 index 0000000000..fdb3f6584f --- /dev/null +++ b/tests/typed-imports/playwright-core/locatorGenerators.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/locatorGenerators'); diff --git a/tests/typed-imports/playwright-core/locatorParser.d.ts b/tests/typed-imports/playwright-core/locatorParser.d.ts new file mode 100644 index 0000000000..64f3650799 --- /dev/null +++ b/tests/typed-imports/playwright-core/locatorParser.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/utils/isomorphic/locatorParser'; diff --git a/tests/typed-imports/playwright-core/locatorParser.js b/tests/typed-imports/playwright-core/locatorParser.js new file mode 100644 index 0000000000..8fae4f0a41 --- /dev/null +++ b/tests/typed-imports/playwright-core/locatorParser.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/locatorParser'); diff --git a/tests/typed-imports/playwright-core/selectorParser.d.ts b/tests/typed-imports/playwright-core/selectorParser.d.ts new file mode 100644 index 0000000000..7da3c34b03 --- /dev/null +++ b/tests/typed-imports/playwright-core/selectorParser.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/utils/isomorphic/selectorParser'; diff --git a/tests/typed-imports/playwright-core/selectorParser.js b/tests/typed-imports/playwright-core/selectorParser.js new file mode 100644 index 0000000000..b39a5454b9 --- /dev/null +++ b/tests/typed-imports/playwright-core/selectorParser.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/selectorParser'); diff --git a/tests/typed-imports/playwright-core/socksProxy.d.ts b/tests/typed-imports/playwright-core/socksProxy.d.ts new file mode 100644 index 0000000000..f7c641293e --- /dev/null +++ b/tests/typed-imports/playwright-core/socksProxy.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/common/socksProxy'; diff --git a/tests/typed-imports/playwright-core/socksProxy.js b/tests/typed-imports/playwright-core/socksProxy.js new file mode 100644 index 0000000000..f2f98105e4 --- /dev/null +++ b/tests/typed-imports/playwright-core/socksProxy.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/common/socksProxy'); diff --git a/tests/typed-imports/playwright-core/traceUtils.d.ts b/tests/typed-imports/playwright-core/traceUtils.d.ts new file mode 100644 index 0000000000..f8acc92185 --- /dev/null +++ b/tests/typed-imports/playwright-core/traceUtils.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/utils/isomorphic/traceUtils'; diff --git a/tests/typed-imports/playwright-core/traceUtils.js b/tests/typed-imports/playwright-core/traceUtils.js new file mode 100644 index 0000000000..b024e3dee8 --- /dev/null +++ b/tests/typed-imports/playwright-core/traceUtils.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/traceUtils'); diff --git a/tests/typed-imports/playwright-core/utils.d.ts b/tests/typed-imports/playwright-core/utils.d.ts new file mode 100644 index 0000000000..caf553c6c9 --- /dev/null +++ b/tests/typed-imports/playwright-core/utils.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../../../packages/playwright-core/src/utils'; \ No newline at end of file diff --git a/tests/typed-imports/playwright-core/utils.js b/tests/typed-imports/playwright-core/utils.js new file mode 100644 index 0000000000..6b9cbe8194 --- /dev/null +++ b/tests/typed-imports/playwright-core/utils.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utils'); \ No newline at end of file diff --git a/tests/typed-imports/playwright-core/utilsBundle.d.ts b/tests/typed-imports/playwright-core/utilsBundle.d.ts new file mode 100644 index 0000000000..efea88d63f --- /dev/null +++ b/tests/typed-imports/playwright-core/utilsBundle.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright-core/src/utilsBundle'; diff --git a/tests/typed-imports/playwright-core/utilsBundle.js b/tests/typed-imports/playwright-core/utilsBundle.js new file mode 100644 index 0000000000..2ee4d4d8ec --- /dev/null +++ b/tests/typed-imports/playwright-core/utilsBundle.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('../../../packages/playwright-core/lib/utilsBundle');