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

esm: mordernise old tests #50639

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JakobJingleheimer
Copy link
Contributor

My goal is to improve DX and performance. The way old tests were written makes them very difficult to figure out what they're even asserting and, when they're failing, why.

Converting them to node's test runner in concurrent mode should on its own improve run-time (the first test I ported, which is quite a small test, improved its run-time by ~10%).

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Nov 9, 2023
Comment on lines +48 to +56
try {
require('../fixtures/es-modules/package-type-module/index.js');
assert.fail('Expected CJS to fail loading from type: module package.');
} catch (e) {
assert.match(e.toString(), /require\(\) of ES Module/g);
assert.match(e.message, /require\(\) of ES Module/g);
assert.strictEqual(e.code, 'ERR_REQUIRE_ESM');
assert.strictEqual(e.name, 'Error');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use assert.throws, no?

This was referenced Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants