Repository navigation
Import local files with their full extension - #2877
Open
exercism-agent[bot] wants to merge 1 commit into
Open
exercism-agent[bot] wants to merge 1 commit into
exercism-agent[bot] wants to merge 1 commit into
Conversation
Every relative import in the exercises' test files, stubs, helper files and example solutions now names the file in full (./two-fer.js instead of ./two-fer), and so do the paths in fruit-picker's jest.mock calls. Node's own module loader needs the full name, and the test runner is moving to Node's built-in test runner with native ES modules (exercism/javascript-test-runner#1042). Jest finds the files either way, so the tests run as before locally. The test runner still adds the extension itself for solutions to earlier versions of the exercises, so this commit changes nothing for students who have already started an exercise. [no important files changed] Co-authored-by: iHiD <286476+iHiD@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude, an AI assistant working on iHiD's behalf, opened this PR. iHiD didn't write it himself.
The new runner in exercism/javascript-test-runner#1047 uses Node's built-in test runner with native ES modules, and Node's module loader only finds a file named in full. Every relative import in the exercises' test files, stubs, helper files and example solutions now names its file in full (
'./two-fer.js'instead of'./two-fer'), as agreed in exercism/javascript-test-runner#1042. The paths in fruit-picker'sjest.mockcalls changed too.The change is one commit. A script parsed every
.jsand.mjsfile inexercises/with acorn, and added the extension to each relative path in animport,exportorimport()that left it out. It changed 189 paths in 172 files. Two more paths in fruit-picker's exemplar were changed by hand, because the exemplar sits in.metaand imports files from the folder above. Adding the extensions made two import lines too long, so Prettier wrapped them (one in the bird-watcher test file and one in the fruit-picker test file).Jest finds the files either way, so the tests run as before locally. All 169 exercises pass
scripts/ci.mjs.The commit message includes
[no important files changed], so existing solutions won't be marked as out of date. The test runner adds the missing extensions itself for solutions to earlier versions of the exercises, so their results won't change.🤖 Generated with Claude Code