-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
One unit test fails with pnpm, works with npm #7368
Comments
The failing test was added in #5584 and has not been touched since. My proposed fix would be to edit the test to allow the test to pass when The root cause of this issue, of course, is in either pnpm or the source-map package, but I don't have time right now to go digging into those projects' source to figure out why source-map is acting slightly differently when installed via pnpm vs. npm. So I'm proposing a small tweak to this test in order to patch over the difference and allow the unit tests to pass whether pnpm or npm is used to install them. Of course, it's also possible that this is something unique to my system. If nobody else can reproduce the issue by using pnpm, then I'll close the issue and figure out what's different about my setup. But if this is an issue that affects anyone who uses pnpm in the Svelte repo, then it's probably worth applying a band-aid over this one test to allow the column value to vary by 1. |
Can you post or diff both |
Here are the two lists, one with P.S. The second list was created with |
Here are the two lists with npm-list.json.txt Note: renamed .json to .json.txt so that GitHub would allow uploading the files as issue attachments (it was rejecting the .json extension). |
Nope, still not diffable as pnpm has way more details in its json output than npm does. But I did do a Ctrl+F for |
A regex replace for |
Can no longer reproduce, and development is moving on to version 4 so any test issues on the |
Describe the bug
The
test/sourcemaps/samples/compile-option-dev/test.js
unit test somehow produces different results when you've installed Svelte dependencies withpnpm
vs withnpm
. Since I prefer to use pnpm (which can deduplicate packages across node_modules folders from multiple projects, saving a lot of disk space), this means that every time I want to create a Svelte PR, I have to edit that test file and change the expected values in it, then make sure those edits don't make it into my PR.Reproduction
test/sourcemaps/samples/compile-option-dev/
totest/sourcemaps/samples/compile-option-dev.solo/
to run only this test. (This doesn't change the results, just the speed of running the tests)npm i
, thennpm run test
.pnpm import
to convertpackage-lock.json
to apnpm-lock.yaml
file with the same package version numbers in it.rm -rf node_modules
, thenpnpm i
to ensure that PNPM is the one that has created the node_modules folderpnpm run test
(ornpm run test
, both will produce the same result)The test failure is caused by the column numbers produced by
SourceMapConsumer.originalPositionFor
from thesource-map
package. When that package is installed vianpm
, the two column numbers checked for in that test are 5. When the package is installed viapnpm
, the two column numbers are 4 instead of 5. (The logs only show one test failure, on the--done-replace-once
check, but if you edit its column number to expect 4, the--done-replace-twice
check will also fail with actual=4 and expected=5). Logs from a failed test run (runningpnpm run test
) are below.Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: