Skip to content

Conversation

@omnibs
Copy link
Contributor

@omnibs omnibs commented Nov 17, 2025

Fixes #652

This implements behavior described in the "A fix" section of the issue linked above:

  • If the package is an indirect dependency, prioritize:
    • Its pinned indirect dependency version
    • In ascending order: any newer versions of the indirect dependency
    • In descending order: any older versions of the indirect dependency
  • If the package is not an indirect dependency, keep current behavior

elm-test was running tests with indirect dependencies always at latest
available version, regardless of whether the app under test had indirect
dependencies pinned to an earlier version.

This can lead to tests behaving different from real world apps.

The reason is elm-solve-deps always picks the first acceptable version
given to it in the versions array.

This commit fixes the issue by ensuring indirect dependencies' versions
are always sorted in this order:
- the pinned version first
- versions higher than the pinned version, in ascending order
- versions lower than the pinned version, in descending order
@omnibs
Copy link
Contributor Author

omnibs commented Nov 17, 2025

I think CI is stuck. I noticed this locally too, but thought it was some weirdness on my computer. Mocha never exits, just hangs after reporting success.

@lydell
Copy link
Collaborator

lydell commented Nov 17, 2025

Turns out it’s due to these lines:

wasm.init();
const syncGetWorker /*: {| get: (string) => string, shutDown: () => void |} */ =
SyncGet.startWorker();

I’m currently looking at moving those lines to a function that will be called by the real code but not by tests.

@omnibs
Copy link
Contributor Author

omnibs commented Nov 17, 2025

Ah, requiring DependencyProvider.js starts the SyncGet Worker and never terminates it.

@omnibs
Copy link
Contributor Author

omnibs commented Nov 17, 2025

oops hadn't seen your message 😅

@lydell
Copy link
Collaborator

lydell commented Nov 17, 2025

Pushed a commit that lazily initializes the worker. Now the tests finish. What do you think about the approach?

Comment on lines +11 to +19
// Poor man’s type alias. We can’t use /*:: type SyncGetWorker = ... */ because of:
// https://github.com/prettier/prettier/issues/2597
const SyncGetWorker /*: {
get: (string) => string,
shutDown: () => void,
} */ {
} */ = {
get: (string) => string,
shutDown: () => {},
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ha, i was trying to figure out how to do type aliases in old flow!

Comment on lines +15 to +20
function syncGetWorker() /*: typeof SyncGet.SyncGetWorker */ {
if (syncGetWorker_ === undefined) {
syncGetWorker_ = SyncGet.startWorker();
}
return syncGetWorker_;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, clean workaround.

@lydell
Copy link
Collaborator

lydell commented Nov 17, 2025

The macOS jobs get stuck without changes as well: #654

So I’m gonna merge this anyway, and make a release tomorrow.

@omnibs
Copy link
Contributor Author

omnibs commented Nov 17, 2025

Thank you! Really appreciate the help with the stuck jobs 💜

@lydell lydell merged commit e2bf3e4 into rtfeldman:master Nov 17, 2025
14 of 39 checks passed
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.

elm-test not respecting indirect dependency versions for app-under-test

2 participants