test: run unit tests before integration tests#1832
Merged
Conversation
This change: * executes unit tests before integration tests, ensuring faster failure and cleaner reporting * implements mocha global setup/teardown more idiomatically * protects against mistakes like that fixed in getodk#1828
added 2 commits
May 21, 2026 10:16
matthew-white
approved these changes
May 21, 2026
|
|
||
| .PHONY: test-fast | ||
| test-fast: node_version | ||
| NODE_CONFIG_ENV=test BCRYPT=insecure npx mocha --recursive --fgrep @slow --invert |
Member
There was a problem hiding this comment.
I'm noticing that test-fast set NODE_CONFIG_ENV=test, while test didn't. It probably doesn't really matter for this PR though. This PR is taking a different approach with test and test-fast, relating them to test-unit and test-integration. Even test-unit and test-integration do different things from one another when it comes to NODE_CONFIG_ENV.
Contributor
Author
There was a problem hiding this comment.
Due to line 3 (
Line 3 in 05bc5c0
NODE_CONFIG_ENV is pretty much always test anyway.
I'm not really sure of the purpose of this, as there is no config/test.json. Perhaps @sadiqkhoja can give more context.
Given that NODE_CONFIG_ENV defaults to test, and there is no config/test.json, I don't think this change is going to have an obvious effect.
ktuite
approved these changes
May 22, 2026
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.
This change:
test/util/**,test/format/**,test/data/**only loaded on demand)This change will allow a failed unit test to fail the full test pipeline significantly faster than previously.
What has been done to verify that this works as intended?
Why is this the best possible solution? Were any other approaches considered?
testdirectory.An alternative approach (or additional change) could be to "shift left" more by:
test: lint test-unit test-integration-fast test-integration-slowHow does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
No effect - just tests.
Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.
No.
Before submitting this PR, please make sure you have:
make testand confirmed all checks still pass, or witnessed Github completing all checks with success