Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion packages/playwright-test/ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ This project incorporates components from the projects listed below. The origina
- @babel/[email protected] (https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-async-generators)
- @babel/[email protected] (https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-dynamic-import)
- @babel/[email protected] (https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-namespace-from)
- @babel/[email protected] (https://github.com/babel/babel)
- @babel/[email protected] (https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-json-strings)
- @babel/[email protected] (https://github.com/babel/babel)
- @babel/[email protected] (https://github.com/babel/babel)
Expand Down Expand Up @@ -1338,6 +1339,33 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF @babel/[email protected] AND INFORMATION

%% @babel/[email protected] NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License

Copyright (c) 2014-present Sebastian McKenzie and other contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF @babel/[email protected] AND INFORMATION

%% @babel/[email protected] NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Expand Down Expand Up @@ -3841,6 +3869,6 @@ END OF [email protected] AND INFORMATION

SUMMARY BEGIN HERE
=========================================
Total Packages: 131
Total Packages: 132
=========================================
END OF SUMMARY
23 changes: 23 additions & 0 deletions packages/playwright-test/bundles/babel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/playwright-test/bundles/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
"@babel/plugin-syntax-async-generators": "^7.8.4",
"@babel/plugin-syntax-import-assertions": "^7.20.0",
"@babel/plugin-syntax-json-strings": "^7.8.3",
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/playwright-test/bundles/babel/src/babelBundleImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export function babelTransform(filename: string, isTypeScript: boolean, isModule
if (!isModule) {
plugins.push([require('@babel/plugin-transform-modules-commonjs')]);
plugins.push([require('@babel/plugin-proposal-dynamic-import')]);
} else {
plugins.push([require('@babel/plugin-syntax-import-assertions')]);
}

plugins.unshift(additionalPlugin);
Expand Down
22 changes: 22 additions & 0 deletions tests/playwright-test/esm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ test('should load nested as esm when package.json has type module', async ({ run
expect(result.passed).toBe(1);
});

test('should support import assertions', async ({ runInlineTest, nodeVersion }) => {
// We only support experimental esm mode on Node 16+
test.skip(nodeVersion.major < 16);
const result = await runInlineTest({
'playwright.config.ts': `
import packageJSON from './package.json' assert { type: 'json' };
export default { };
`,
'package.json': JSON.stringify({ type: 'module' }),
'a.esm.test.ts': `
const { test } = pwt;

test('check project name', ({}, testInfo) => {
expect(1).toBe(1);
});
`
});

expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
});

test('should import esm from ts when package.json has type module in experimental mode', async ({ runInlineTest, nodeVersion }) => {
// We only support experimental esm mode on Node 16+
test.skip(nodeVersion.major < 16);
Expand Down