Enhancement: Separate Unit and Integration Test Scripts in package.json
Increasing Access
Separating unit and integration test scripts could improve the developer experience for contributors interacting with the test suite.
Currently all tests are executed using a single command (npm run test). Introducing clearer scripts for different test scopes would help contributors understand how tests are organized and how they should run them during development.
This can lower the barrier for new contributors by making the testing workflow easier to understand and by clarifying where different types of tests should live in the project.
Feature request details
Summary
Currently the project runs tests using a single script:
npm run test
which maps to:
"test": "NODE_ENV=test jest"
This executes all tests together without distinguishing between unit tests and integration tests.
Context
I understand that the project may still need additional tests in different areas and that expanding the test suite is an ongoing effort.
However, even with the current test coverage, introducing clearer testing scripts could help improve contributor understanding of the testing structure and how tests should be executed during development.
Proposed Enhancement
Introduce separate npm scripts for different types of tests.
Example structure:
"scripts": {
"test": "npm run test:all",
"test:unit": "NODE_ENV=test jest tests/unit",
"test:integration": "NODE_ENV=test jest tests/integration",
"test:all": "npm run test:unit && npm run test:integration",
"test:watch": "NODE_ENV=test jest --watch",
"test:ci": "npm run lint && npm run test:all"
}
This would allow contributors to run:
npm run test:unit npm run test:integration npm run test
Benefits
• Improves clarity for contributors about how tests are structured
• Makes it easier to run specific categories of tests during development
• Helps contributors understand where new tests should be added
• Provides a scalable foundation if more tests (such as integration or E2E tests) are added later
to be honest there are very less integration tests present most of the tests are unit idk if it makes sense to separate them.
I think @Jatin24062005 has a great point about making the testing workflow more transparent for newcomers. Even if the integration suite is small right now, having a clear 'home' for those tests makes it easier for others to contribute more of them later.
However, I also agree with @kunstewi that we should avoid creating 'ghost' scripts if there isn't much to run. Maybe a good compromise would be to update the test script to use Jest's project configuration or folder patterns?
This way, we can keep one command for now but clearly document in the README or a new testing.md section how to run unit vs. integration tests using flags (like jest tests/unit). It keeps the package.json clean while still providing that 'decision-oriented' guidance we discussed in #3965.
Hi everyone,
I've been exploring this issue while preparing for GSoC contributions around testing.
From the current discussion and codebase, it seems that most of the existing tests are unit tests, with very few integration tests at the moment.
Because of that, introducing separate scripts like test:unit and test:integration right now might be a bit premature and could add unused or low-value scripts to package.json.
Instead, would it make sense to first focus on:
- Improving the test structure (e.g., clearer separation or conventions for unit vs integration tests), and
- Adding documentation to explain how contributors should organize and run tests?
This could improve clarity immediately without introducing additional maintenance overhead, and also prepare a solid foundation for future testing improvements like E2E.
Happy to work on this direction based on maintainer feedback.
Hi folks, I agree with @kunstewi that there are not enough tests on the codebase to make this split worth it. Additionally the e2e tests that @Geethegreat has set up have helped cover the gaps.
I will close this issue, but I encourage newcomers to the repo to help write tests as their starting contribution, especially in the client portion of the codebase