27 Commits

Author SHA1 Message Date
Max Schmitt
2b2a57abad
chore: enable @babel/plugin-syntax-import-attributes all the time (#32713) 2024-09-19 16:51:35 +02:00
Dmitry Gozman
a54ed48b42
feat(test runner): --tsconfig cli option (#31932)
Introduce `--tsconfig` to specify a single config to be used for all
imported files, instead of looking up tsconfig for each file separately.

Fixes #12829.
2024-08-06 06:55:15 -07:00
Max Schmitt
c8c37009c3
test(esm): fix import attribute tests (#30798)
Pre Node.js `18.20.0`:

- `assert` is supported

Post Node.js `18.20.0`

- `assert` and `with` is supported.

Before https://github.com/microsoft/playwright/pull/30482 we kept
`asserts` in the JS code, Node.js was interpreting them. The `with`
keyword was not supported, this was what the PR was fixing.

After https://github.com/microsoft/playwright/pull/30482 Babel is
converting `assert` (deprecated) into `with` (successor) since we use
the `deprecatedAssertSyntax` option.

This means, that the minimum Node.js version we support in order to use
import attributes is now `18.20.0` where they added the `with` support.
This follows our principle of supporting only the latest minor release
for Node.js versions.

See here for the 18.20 changelog:

> #### Added support for import attributes
>
> Support has been added for import attributes, to replace the old
import
> assertions syntax. This will aid migration by making the new syntax
available
> across all currently supported Node.js release lines.
>
> This adds the `with` keyword which should be used in place of the
previous
> `assert` keyword, which will be removed in a future semver-major
Node.js
> release.
>
> For example,
>
> ```console
> import "foo" assert { ... }
> ```
>
> should be replaced with
>
> ```console
> import "foo" with { ... }
> ```

Fixes https://github.com/microsoft/playwright/pull/30482 - the tests
were a noop before, since they were tree-shaked by Babel.
2024-05-14 17:59:41 +01:00
Pavel Feldman
f5ca5241f3
feat(esm): support import attributes (#30482)
Fixes https://github.com/microsoft/playwright/issues/30473
2024-04-23 10:13:01 -07:00
Dmitry Gozman
e18a358bc6
test: check that ESM loader works without config with type:module (#30258) 2024-04-05 07:03:27 -07:00
Dmitry Gozman
be1af15d57
feat: always enable ESM loader with the new API (#29991)
It does not require a process restart anymore, so safe to enable.

Fixes #29747.
2024-03-18 21:54:25 -07:00
Dmitry Gozman
f605a5009b
fix(esmLoader): do not serialize the whole compilation cache after each import (#29464)
Instead, send the newly created cache entry only.

References #29418.
2024-02-12 16:39:53 -08:00
Pavel Feldman
4bafe71eb1
chore: unconflict ct test ports (#29332) 2024-02-05 16:47:39 -08:00
Yury Semikhatsky
6d583a2dbe
fix: exit from merge-reports in type: "module" projects (#28725)
Fixes https://github.com/microsoft/playwright/issues/28699
2023-12-19 16:49:25 -08:00
Max Schmitt
fd2fbe9d2f
fix: merge{Tests,Expects} via ESM imports (#27630)
Backport to 1.39.X?

Fixes https://github.com/microsoft/playwright/issues/27617
2023-10-17 00:09:44 +02:00
Max Schmitt
bd988b34a7
chore: allow calling spawnSync on Node.js file inside test (#26429)
Fixes https://github.com/microsoft/playwright/issues/24516

Relates https://github.com/microsoft/playwright/pull/16733
2023-08-11 18:37:14 +02:00
Pavel Feldman
b3ce913551
Revert "chore: allow calling spawnSync on Node.js file inside test" (#24611)
Reverts microsoft/playwright#24539
2023-08-04 09:01:38 -07:00
Max Schmitt
2193903d03
chore: allow calling spawnSync on Node.js file inside test (#24539)
Fixes https://github.com/microsoft/playwright/issues/24516 

Relates https://github.com/microsoft/playwright/pull/16733
2023-08-04 00:03:14 +02:00
Kristo Jorgenson
d5d155df1f
fix(typescript): allow directory imports (#23254)
This updates previous work in #22887 to align more fully with
`--moduleResolution=bundler`, allowing index files to be imported with
the /index extension

---------

Signed-off-by: Kristo Jorgenson <kristojorg@users.noreply.github.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2023-06-05 08:58:25 -07:00
Pavel Feldman
2fc6341841
chore: remove node version checks from esm tests (#23031) 2023-05-16 11:07:34 -07:00
Dmitry Gozman
44a934c160
feat(test runner): support .cjs and .cts files (#22971)
Fixes #22579.
2023-05-11 15:41:50 -07:00
Dmitry Gozman
cd49f5c466
feat(typescript): align with --moduleResolution=bundler (#22887)
This relaxes import requirements and allows importing `.ts` files
without an extension in CJS and ESM modes.

Fixes #22169.
2023-05-09 16:26:29 -07:00
Dmitry Gozman
91da67fab1
test: remove magic headers in ttest (#20867)
Instead, explicitly import from '@playwright/test'.
2023-02-14 19:20:56 -08:00
Pavel Feldman
1b941bcf2e
chore: simplify ttests (#20733) 2023-02-07 15:11:44 -08:00
Pavel Feldman
9f31bcfbab
chore: refactor graceful close, rename to host/main (#20283) 2023-01-22 15:04:29 -08:00
Andrey Lushnikov
92375f6333
fix: support import assertions (#20009)
Fixes #19928

Co-authored-by: Max Schmitt <max@schmitt.mx>
2023-01-16 08:26:14 -08:00
Pavel Feldman
736cf5c585
fix(tsx): resolve .js imports to .tsx as well (#20092)
Fixes: https://github.com/microsoft/playwright/issues/20039
2023-01-13 10:49:10 -08:00
Pavel Feldman
c0e4caa604
fix(esm+tsconfig): allow mapped ts files in esm mode (#17862)
Fixes https://github.com/microsoft/playwright/issues/17840
2022-10-05 18:00:49 -07:00
Max Schmitt
3d1d723c56
fix(esm): show codeframe when errors get reported (#15262) 2022-06-30 21:17:08 +02:00
Ross Wollman
9fb80c905b
test: match more of output to ensure source map support is good (#15206)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-06-29 22:26:48 +02:00
Pavel Feldman
e912b6897d
fix(esm): respect source maps in esm-transpiled code (#14561) 2022-06-01 16:50:23 -07:00
Dmitry Gozman
9420a53939
fix(esm): make sure import from './foo.js' is supported (#13137)
Drive-by: migrate all @esm tests to esm.spec.ts.
2022-03-28 14:37:46 -07:00