Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(playwright-test): have the proper default export #7328

Merged
merged 2 commits into from
Jun 25, 2021

Conversation

JoelEinbinder
Copy link
Contributor

@JoelEinbinder JoelEinbinder commented Jun 25, 2021

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).

@mxschmitt mxschmitt added the CQ1 label Jun 25, 2021
@aslushnikov aslushnikov merged commit 7caf05b into microsoft:master Jun 25, 2021
aslushnikov pushed a commit to aslushnikov/playwright that referenced this pull request Jun 25, 2021
…7328)

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).
aslushnikov added a commit that referenced this pull request Jun 25, 2021
)

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).

Co-authored-by: Joel Einbinder <joel.einbinder@gmail.com>
@jdalton jdalton mentioned this pull request Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants