-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
SDK version
- Using Lit JS SDK (master branch, commit xyz, etc.)
Lit Network
- N/A (this is a tooling/script issue, not network-specific)
Description of the bug/issue
We have a script in tools/scripts/tools.mjs that handles various commands, including --test --unit. However, currently the testFunc() implementation only shows a usage message and exits, and does not actually call yarn test:unit. As a result, yarn tools --test --unit completes without running any tests.
Expected Behavior
- When we do
yarn tools --test --unit, the script should invokeyarn test:unit(ornx run-many --target=test) to run all unit tests. - The same should happen in CI, so that our tests really run as intended.
Severity of the bug
- Our CI workflow uses
run: yarn tools --test --unit(e.g., in.github/workflows/ci.yml) expecting to run the full unit test suite. - In reality, no tests are run, which can lead to undetected failing tests and false-positive CI passes.
Steps To Reproduce
- Run
yarn tools --test --unitlocally - Notice that it prints usage info, then exits without invoking
yarn test:unit - Check your console or logs — no tests are actually executed.
Link to code
https://github.com/LIT-Protocol/js-sdk/blob/master/tools/scripts/tools.mjs#L230
Proposed Fix or Approaches
Inside tools/scripts/tools.mjs, in the testFunc() function, we can add logic like:
async function testFunc() {
const TEST_TYPE = args[1];
if (!TEST_TYPE || TEST_TYPE === '' || TEST_TYPE === '--help') {
// show usage
...
exit();
}
if (TEST_TYPE === '--unit') {
// Actually run the tests
await childRunCommand('yarn test:unit');
exit();
}
// optionally handle other test types if needed
redLog(\`Unrecognized test type: \${TEST_TYPE}\`);
exit();
}This way, yarn tools --test --unit truly calls yarn test:unit. After implementing this, our CI job run: yarn tools --test --unit will genuinely run the unit tests.
Anything else?
- We might want to add more test categories (e.g.
--test --integration) in the same manner. - If the CI intentionally wants a different test command, we should clarify that in the script logic.
Metadata
Metadata
Assignees
Labels
No labels