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

Test on Node 10, 12 and latest #254

Closed
wants to merge 2 commits into from
Closed

Test on Node 10, 12 and latest #254

wants to merge 2 commits into from

Conversation

DanielRuf
Copy link

It seems the builds for 12 and latest fail because of different snapshots.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 46.86% when pulling 1f6599f on DanielRuf:ci/test-node-10-12-latest into fd4195d on jlfwong:master.

@DanielRuf
Copy link
Author

https://travis-ci.org/jlfwong/speedscope/jobs/637907131#L291

This is due to the v8 changes affecting sort(), for this localeCompare() or a custom sorting algorithm / custom compare function has to be used.

Array.sort() is now basically really stable and it was unstable up to Node 12.

https://v8.dev/blog/array-sort
https://v8.dev/features/stable-sort

expect(received).toEqual(expected) // deep equality

- Expected
+ Received

  Array [
-   "a;b;e",
-   "a;b;b",
-   "a;b;c",
    "a;b;d",
+   "a;b;c",
+   "a;b;b",
+   "a;b;e",
    "a;b",
    "a",
  ]

@DanielRuf
Copy link
Author

See moment/moment-timezone#762 for example.

The rest of the failing tests seem to be because of the differences in the tracing and performance of NodeJS >= 12.

@jlfwong
Copy link
Owner

jlfwong commented Jan 16, 2020

Iiiinteresting. Thanks! I'll check out the branch sometime in the next few weeks and see if I can work through the sources of the issues. Thanks for the diagnosis and links to references!

@jlfwong
Copy link
Owner

jlfwong commented Apr 20, 2020

Closing this since it's superseded by #263.

Thanks again for filing this and explaining the sort stability issue -- it probably would've taken me a very long time to figure out root cause without the explanation!

@jlfwong jlfwong closed this Apr 20, 2020
jlfwong added a commit that referenced this pull request Apr 20, 2020
@JustinBeckwith pointed out in #262 that `npm install` was broken in node 13.x, and @DanielRuf pointed in #254 that test fail for node 11+ because of a change to stability of sorting.

This PR seeks to address both of those.

The installation issue was fixed by just regenerating `package-lock.json` without needing to bump any of the direct dependency versions. The test failure issue requires manual intervention.

To fix the sort stability issue, I updated the tests to use the stable sort values (these were all the correct values, though some of the test values were incorrect).

To make the suite still pass for node 10, I added a hack where I override `Array.prototype.sort` with a stable implementation that's *only* used in tests (See comments in code for a justification for why)

## Test Plan

Before this PR: `npm install` on node 13.x fails & `npm run jest` results in test failures
After this PR: `npm install` on node 13.x passes & `npm run jest` passes for node 10, 12, and 13.
jackerghan pushed a commit to jackerghan/speedscope that referenced this pull request Jul 28, 2023
…wong#263)

@JustinBeckwith pointed out in jlfwong#262 that `npm install` was broken in node 13.x, and @DanielRuf pointed in jlfwong#254 that test fail for node 11+ because of a change to stability of sorting.

This PR seeks to address both of those.

The installation issue was fixed by just regenerating `package-lock.json` without needing to bump any of the direct dependency versions. The test failure issue requires manual intervention.

To fix the sort stability issue, I updated the tests to use the stable sort values (these were all the correct values, though some of the test values were incorrect).

To make the suite still pass for node 10, I added a hack where I override `Array.prototype.sort` with a stable implementation that's *only* used in tests (See comments in code for a justification for why)

## Test Plan

Before this PR: `npm install` on node 13.x fails & `npm run jest` results in test failures
After this PR: `npm install` on node 13.x passes & `npm run jest` passes for node 10, 12, and 13.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants