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

Migrate test suite to ES modules #1034

Merged

Conversation

bertdeblock
Copy link
Member

No description provided.

@bertdeblock bertdeblock self-assigned this Dec 18, 2024
@@ -4,6 +4,10 @@ module.exports = {
{
env: { mocha: true },
files: ['test/**/*.js'],
parserOptions: { sourceType: 'module' },
rules: {
'n/no-extraneous-import': 'off',
Copy link
Member Author

Choose a reason for hiding this comment

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

I assume because we use a "fake" package.json file to force ES modules for the test folder. Can probably be deleted once we use "type": "module" in the root package.json file.

@@ -51,17 +51,17 @@
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@release-it-plugins/lerna-changelog": "^7.0.0",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.1",
"chai": "^5.1.2",
Copy link
Member Author

Choose a reason for hiding this comment

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

We can now use the latest versions of our test dependencies.

import assertFileContainsJSON from '../helpers/assert-file-contains-json.js';
import generateMockRun from '../helpers/generate-mock-run.js';

const fixtureWorkspaces = fs.readJsonSync('./test/fixtures/package-with-workspaces.json');
Copy link
Member Author

Choose a reason for hiding this comment

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

Can be reverted to an import once we can use import attributes:

import data from "https://example.com/data.json" with { type: "json" };

@@ -0,0 +1,6 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

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

Less work than renaming all files to .mjs and back again to .js.

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.55%. Comparing base (89aa730) to head (7ba588c).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1034   +/-   ##
=======================================
  Coverage   95.55%   95.55%           
=======================================
  Files          22       22           
  Lines         518      518           
=======================================
  Hits          495      495           
  Misses         23       23           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bertdeblock bertdeblock changed the title Migrate test suite to es modules Migrate test suite to ES modules Dec 18, 2024
@bertdeblock bertdeblock merged commit bfd124b into ember-cli:main Dec 18, 2024
35 checks passed
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.

2 participants