chore: make @playwright/test depend on playwright (#26946)

This commit is contained in:
Dmitry Gozman 2023-09-08 14:23:35 -07:00 committed by GitHub
parent 7c0766a273
commit 186f86905c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
165 changed files with 255 additions and 162 deletions

View File

@ -5,7 +5,7 @@ on:
- main
paths:
- 'packages/playwright-core/src/client/**/*'
- 'packages/playwright-test/src/matchers/matchers.ts'
- 'packages/playwright/src/matchers/matchers.ts'
jobs:
check:
name: Check

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ test-results
/packages/*/LICENSE
/packages/*/NOTICE
/packages/playwright/README.md
/packages/playwright-test/README.md
/packages/playwright-core/api.json
.env
/tests/installation/output/

View File

@ -15,7 +15,7 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
### New `npx playwright merge-reports` tool
If you run tests on multiple shards, you can now merge all reports in a single HTML report (or any other report)
If you run tests on multiple shards, you can now merge all reports in a single HTML report (or any other report)
using the new `merge-reports` CLI tool.
Using `merge-reports` tool requires the following steps:
@ -48,7 +48,7 @@ Let us know if you encounter any issues!
Linux support looks like this:
| | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | Debian 12 |
| :--- | :---: | :---: | :---: | :---: |
| :--- | :---: | :---: | :---: | :---: |
| Chromium | ✅ | ✅ | ✅ | ✅ |
| WebKit | ✅ | ✅ | ✅ | ✅ |
| Firefox | ✅ | ✅ | ✅ | ✅ |

16
package-lock.json generated
View File

@ -6300,6 +6300,9 @@
},
"engines": {
"node": ">=16"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
},
"packages/playwright-browser-chromium": {
@ -6367,7 +6370,7 @@
"version": "1.38.0-next",
"license": "Apache-2.0",
"dependencies": {
"@playwright/test": "1.38.0-next",
"playwright": "1.38.0-next",
"playwright-core": "1.38.0-next",
"vite": "^4.3.9"
},
@ -6589,16 +6592,13 @@
"version": "1.38.0-next",
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.38.0-next"
"playwright": "1.38.0-next"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=16"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
},
"packages/playwright-webkit": {
@ -7469,7 +7469,7 @@
"@playwright/experimental-ct-core": {
"version": "file:packages/playwright-ct-core",
"requires": {
"@playwright/test": "1.38.0-next",
"playwright": "1.38.0-next",
"playwright-core": "1.38.0-next",
"vite": "^4.3.9"
}
@ -7575,8 +7575,7 @@
"@playwright/test": {
"version": "file:packages/playwright-test",
"requires": {
"fsevents": "2.3.2",
"playwright-core": "1.38.0-next"
"playwright": "1.38.0-next"
}
},
"@sindresorhus/is": {
@ -9885,6 +9884,7 @@
"playwright": {
"version": "file:packages/playwright",
"requires": {
"fsevents": "2.3.2",
"playwright-core": "1.38.0-next"
}
},

View File

@ -19,9 +19,9 @@
"paths": {
"@protocol/*": ["../protocol/src/*"],
"@web/*": ["../web/src/*"],
"@playwright-test/*": ["../playwright-test/src/*"],
"@playwright/*": ["../playwright/src/*"],
"playwright-core/lib/*": ["../playwright-core/src/*"],
"playwright-test/lib/*": ["../playwright-test/src/*"],
"playwright/lib/*": ["../playwright/src/*"],
}
},
"include": ["src"],

View File

@ -14,4 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = require('@playwright/test/lib/cli');
module.exports = require('playwright/lib/cli');

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from './types/component';
import type { InlineConfig } from 'vite';
@ -63,4 +63,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('playwright/test');
const { fixtures } = require('./lib/mount');
const defineConfig = config => originalDefineConfig({

View File

@ -26,7 +26,7 @@
"dependencies": {
"playwright-core": "1.38.0-next",
"vite": "^4.3.9",
"@playwright/test": "1.38.0-next"
"playwright": "1.38.0-next"
},
"bin": {
"playwright": "./cli.js"

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from '@playwright/test';
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from 'playwright/test';
import type { Component, JsxComponent, MountOptions } from '../types/component';
import type { ContextReuseMode, FullConfigInternal } from '../../playwright-test/src/common/config';
import type { ContextReuseMode, FullConfigInternal } from '../../playwright/src/common/config';
let boundCallbacksForMount: Function[] = [];

View File

@ -15,9 +15,9 @@
*/
import path from 'path';
import type { T, BabelAPI } from '@playwright/test/src/transform/babelBundle';
import { types, declare, traverse } from '@playwright/test/lib/transform/babelBundle';
import { resolveImportSpecifierExtension } from '@playwright/test/lib/util';
import type { T, BabelAPI } from 'playwright/src/transform/babelBundle';
import { types, declare, traverse } from 'playwright/lib/transform/babelBundle';
import { resolveImportSpecifierExtension } from 'playwright/lib/util';
const t: typeof T = types;
const fullNames = new Map<string, string | undefined>();

View File

@ -14,11 +14,11 @@
* limitations under the License.
*/
import type { Suite } from '@playwright/test/reporter';
import type { PlaywrightTestConfig as BasePlaywrightTestConfig, FullConfig } from '@playwright/test';
import type { Suite } from 'playwright/types/testReporter';
import type { PlaywrightTestConfig as BasePlaywrightTestConfig, FullConfig } from 'playwright/test';
import type { InlineConfig, Plugin, ResolveFn, ResolvedConfig, UserConfig } from 'vite';
import type { TestRunnerPlugin } from '../../playwright-test/src/plugins';
import type { TestRunnerPlugin } from '../../playwright/src/plugins';
import type { ComponentInfo } from './tsxTransform';
import type { AddressInfo } from 'net';
import type { PluginContext } from 'rollup';
@ -26,11 +26,11 @@ import { debug } from 'playwright-core/lib/utilsBundle';
import fs from 'fs';
import path from 'path';
import { parse, traverse, types as t } from '@playwright/test/lib/transform/babelBundle';
import { stoppable } from '@playwright/test/lib/utilsBundle';
import { parse, traverse, types as t } from 'playwright/lib/transform/babelBundle';
import { stoppable } from 'playwright/lib/utilsBundle';
import { assert, calculateSha1 } from 'playwright-core/lib/utils';
import { getPlaywrightVersion } from 'playwright-core/lib/utils';
import { setExternalDependencies } from '@playwright/test/lib/transform/compilationCache';
import { setExternalDependencies } from 'playwright/lib/transform/compilationCache';
import { collectComponentUsages, componentInfo } from './tsxTransform';
import { version as viteVersion, build, preview, mergeConfig } from 'vite';

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
@ -63,4 +63,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
@ -63,4 +63,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
@ -63,4 +63,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
import type { SvelteComponent, ComponentProps } from 'svelte/types/runtime';
@ -71,4 +71,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
@ -91,4 +91,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -22,7 +22,7 @@ import type {
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
} from 'playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
@ -91,4 +91,4 @@ export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
export function defineConfig<T, W>(config: PlaywrightTestConfig<T, W>): PlaywrightTestConfig<T, W>;
export { expect, devices } from '@playwright/test';
export { expect, devices } from 'playwright/test';

View File

@ -1,3 +0,0 @@
# @playwright/test
This package contains [Playwright Test](https://playwright.dev/docs/test-intro). A test-runner for writing idiomatic and reliable end-to-end tests with [Playwright](http://playwright.dev/).

View File

@ -14,4 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = require('@playwright/test/lib/cli');
module.exports = require('playwright/cli');

View File

@ -14,5 +14,5 @@
* limitations under the License.
*/
export * from './types/test';
export { default } from './types/test';
export * from 'playwright/test';
export { default } from 'playwright/test';

View File

@ -14,15 +14,4 @@
* limitations under the License.
*/
const pwt = require('./lib/index');
const { defineConfig } = require('./lib/common/configLoader');
const playwright = require('playwright-core');
const combinedExports = {
...playwright,
...pwt,
defineConfig,
};
Object.defineProperty(combinedExports, '__esModule', { value: true });
module.exports = combinedExports;
module.exports = require('playwright/test');

View File

@ -13,18 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import playwright from './index.js';
export const chromium = playwright.chromium;
export const firefox = playwright.firefox;
export const webkit = playwright.webkit;
export const selectors = playwright.selectors;
export const devices = playwright.devices;
export const errors = playwright.errors;
export const request = playwright.request;
export const _electron = playwright._electron;
export const _android = playwright._android;
export const test = playwright.test;
export const expect = playwright.expect;
export const defineConfig = playwright.defineConfig;
export default playwright.test;
export * from 'playwright/test';
export { default } from 'playwright/test';

View File

@ -7,7 +7,10 @@
"engines": {
"node": ">=16"
},
"main": "index.js",
"author": {
"name": "Microsoft Corporation"
},
"license": "Apache-2.0",
"exports": {
".": {
"types": "./index.d.ts",
@ -17,32 +20,14 @@
},
"./cli": "./cli.js",
"./package.json": "./package.json",
"./lib/cli": "./lib/cli.js",
"./lib/transform/babelBundle": "./lib/transform/babelBundle.js",
"./lib/transform/compilationCache": "./lib/transform/compilationCache.js",
"./lib/transform/esmLoader": "./lib/transform/esmLoader.js",
"./lib/internalsForTest": "./lib/internalsForTest.js",
"./lib/plugins": "./lib/plugins/index.js",
"./jsx-runtime": {
"import": "./jsx-runtime.mjs",
"require": "./jsx-runtime.js",
"default": "./jsx-runtime.js"
},
"./lib/util": "./lib/util.js",
"./lib/utilsBundle": "./lib/utilsBundle.js",
"./reporter": "./reporter.js"
},
"bin": {
"playwright": "./cli.js"
},
"author": {
"name": "Microsoft Corporation"
"scripts": {
},
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.38.0-next"
},
"optionalDependencies": {
"fsevents": "2.3.2"
"playwright": "1.38.0-next"
}
}

View File

@ -14,4 +14,4 @@
* limitations under the License.
*/
export * from './types/testReporter';
export * from 'playwright/types/testReporter';

View File

@ -1,4 +1,4 @@
microsoft/playwright-test
microsoft/playwright
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION

View File

@ -65,7 +65,7 @@ function babelTransformOptions(isTypeScript: boolean, isModule: boolean, plugins
// Support JSX/TSX at all times, regardless of the file extension.
plugins.push([require('@babel/plugin-transform-react-jsx'), {
runtime: 'automatic',
importSource: '@playwright/test'
importSource: 'playwright'
}]);
if (!isModule) {

View File

@ -14,4 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = require('playwright-core/lib/cli/cli');
module.exports = require('./lib/cli');

View File

@ -7,10 +7,7 @@
"engines": {
"node": ">=16"
},
"author": {
"name": "Microsoft Corporation"
},
"license": "Apache-2.0",
"main": "index.js",
"exports": {
".": {
"types": "./index.d.ts",
@ -19,14 +16,44 @@
"default": "./index.js"
},
"./cli": "./cli.js",
"./package.json": "./package.json"
"./package.json": "./package.json",
"./lib/cli": "./lib/cli.js",
"./lib/transform/babelBundle": "./lib/transform/babelBundle.js",
"./lib/transform/compilationCache": "./lib/transform/compilationCache.js",
"./lib/transform/esmLoader": "./lib/transform/esmLoader.js",
"./lib/internalsForTest": "./lib/internalsForTest.js",
"./lib/plugins": "./lib/plugins/index.js",
"./jsx-runtime": {
"import": "./jsx-runtime.mjs",
"require": "./jsx-runtime.js",
"default": "./jsx-runtime.js"
},
"./lib/util": "./lib/util.js",
"./lib/utilsBundle": "./lib/utilsBundle.js",
"./types/test": {
"types": "./types/test.d.ts"
},
"./types/testReporter": {
"types": "./types/testReporter.d.ts"
},
"./test": {
"types": "./test.d.ts",
"import": "./test.mjs",
"require": "./test.js",
"default": "./test.js"
}
},
"bin": {
"playwright": "./cli.js"
},
"scripts": {
"author": {
"name": "Microsoft Corporation"
},
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.38.0-next"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
}

View File

@ -26,12 +26,12 @@ import { showHTMLReport } from './reporters/html';
import { createMergedReport } from './reporters/merge';
import { ConfigLoader, resolveConfigFile } from './common/configLoader';
import type { ConfigCLIOverrides } from './common/ipc';
import type { FullResult, TestError } from '../reporter';
import type { FullResult, TestError } from '../types/testReporter';
import type { TraceMode } from '../types/test';
import { builtInReporters, defaultReporter, defaultTimeout } from './common/config';
import type { FullConfigInternal } from './common/config';
import program from 'playwright-core/lib/cli/program';
import type { ReporterDescription } from '..';
import type { ReporterDescription } from '../types/test';
import { prepareErrorStack } from './reporters/base';
function addTestCommand(program: Command) {

View File

@ -20,7 +20,7 @@ import type { Suite, TestCase } from './test';
import type { TestTypeImpl } from './testType';
import type { FullProjectInternal } from './config';
import { formatLocation } from '../util';
import type { TestError } from '../../reporter';
import type { TestError } from '../../types/testReporter';
export class PoolBuilder {
private _project: FullProjectInternal | undefined;

View File

@ -16,7 +16,7 @@
import path from 'path';
import util from 'util';
import type { TestError } from '../../reporter';
import type { TestError } from '../../types/testReporter';
import { isWorkerProcess, setCurrentlyLoadingFileSuite } from './globals';
import { Suite } from './test';
import { requireOrImport } from '../transform/transform';

View File

@ -19,7 +19,7 @@ import { ConfigLoader } from '../common/configLoader';
import { ProcessRunner } from '../common/process';
import type { FullConfigInternal } from '../common/config';
import { loadTestFile } from '../common/testLoader';
import type { TestError } from '../../reporter';
import type { TestError } from '../../types/testReporter';
import { serializeCompilationCache } from '../transform/compilationCache';
import { PoolBuilder } from '../common/poolBuilder';
import { incorporateCompilationCache } from '../common/esmLoaderHost';

Some files were not shown because too many files have changed in this diff Show More