mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
7caf05b24a
There are 3 ways to import `@playwright/test` library in the modern Node.js ecosystem: - Using `require`: works great, this patch doesn't change it - Using `import` statement from `.mjs` file - we have wrong `default` for @playwright/test that should be a `test`. This is what test checks for - Using `import test from '@playwright/test'` from `.ts` file - was broken because TypeScript thought it's a CJS module, whereas it's a ESM module in reality. Also, typescript types import from `.d.ts` file was broken because we had no default export (`export *` syntax does not export default).
26 lines
853 B
JavaScript
26 lines
853 B
JavaScript
/**
|
|
* 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.
|
|
*/
|
|
const pwt = require('./lib/test/index');
|
|
const playwright = require('./lib/inprocess');
|
|
const combinedExports = {
|
|
...playwright,
|
|
...pwt,
|
|
};
|
|
|
|
Object.defineProperty(combinedExports, '__esModule', { value: true });
|
|
|
|
module.exports = combinedExports;
|