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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrate playgrounds to ESM #13094

Merged
merged 6 commits into from May 9, 2023
Merged

test: migrate playgrounds to ESM #13094

merged 6 commits into from May 9, 2023

Conversation

fi3ework
Copy link
Member

@fi3ework fi3ework commented May 4, 2023

Description

A successor of #8252 and #12131. This PR mainly contains the following changes.

  • adding "type": "module for most packages in /playground except the ones for testing in CJS, they're:
    • playground/cli/package.json
    • playground/css-codesplit-cjs/package.json:
    • playground/define/commonjs-dep/package.json
    • playground/resolve/exports-and-nested-scope/package.json
    • playground/resolve/exports-with-module/package.json
    • playground/resolve-config/package.json
    • playground/ssr-noexternal/require-external-cjs/package.json
  • changed some test cases from .mjs -> .js due to type: module toggling the dist artifacts ext.
  • remove playground/hmr/tsconfig.json which is no longer useful.
  • found an orphan test file (playground/json/server.js) from fix(ssr): avoid transforming json file in ssrTransform聽#6597. The file is not invoked because that PR merged after /packages/playground/json moves to /playground/json and becomes ineffective in rebasing. The weird thing is that I didn't see added new test case in fix(ssr): avoid transforming json file in ssrTransform聽#6597(Did I miss something 馃?). So I tried to add some basic test cases for it. And I leave some // TODO: what is this for? on some lines I don't understand clearly.
  • adding import/no-commonjs for playground with some excluded CJS fixtures to keep using ESM afterward.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented May 4, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@fi3ework
Copy link
Member Author

fi3ework commented May 5, 2023

@poyoho
Copy link
Member

poyoho commented May 5, 2023

The test will test the large json file in ssr bundle with esm would not to out of max timeline.

@fi3ework
Copy link
Member Author

fi3ework commented May 5, 2023

The test will test the large json file in ssr bundle with esm would not to out of max timeline.

@poyoho So I guess we do not need to test the metrics result of the line under // TODO: what is this for?. Is it for local debugging only? 馃

// TODO: what is this for?
text('.fetch-json-module code', Date.now() - startModule)
const startFs = Date.now()
text('.fetch-json-fs pre', await (await fetch('/json-fs')).text())
// TODO: what is this for?
text('.fetch-json-fs code', Date.now() - startFs)

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for migrating these once again! Left some comments below, mostly nitpicks.

playground/resolve/browser-field/multiple.dot.path.js Outdated Show resolved Hide resolved
playground/resolve/browser-field/not-browser.js Outdated Show resolved Hide resolved
playground/alias/vite.config.js Outdated Show resolved Hide resolved
playground/config/__tests__/load.spec.ts Outdated Show resolved Hide resolved
playground/json/index.ssr.html Outdated Show resolved Hide resolved
playground/tailwind/postcss.config.ts Outdated Show resolved Hide resolved
@bluwy bluwy added p1-chore Doesn't change code behavior (priority) test labels May 8, 2023
@fi3ework fi3ework requested a review from bluwy May 9, 2023 03:36
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 馃敟

@patak-dev patak-dev merged commit a8c7eb2 into vitejs:main May 9, 2023
13 checks passed
@fi3ework fi3ework deleted the test-esm branch May 9, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-chore Doesn't change code behavior (priority) test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants