Skip to content

Statically import runCommand functions in CLI tests#2345

Merged
fredrikekelund merged 2 commits into
dev/studio-cli-i2from
f26d/cli-static-test-imports
Jan 6, 2026
Merged

Statically import runCommand functions in CLI tests#2345
fredrikekelund merged 2 commits into
dev/studio-cli-i2from
f26d/cli-static-test-imports

Conversation

@fredrikekelund

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

@wojtekn asked (p1766602221612649-slack-C06DRMD6VPZ) why we dynamically import the runCommand functions in the CLI tests. When I dug into this, I quickly concluded that it's not necessary. Static imports yield better performance and better error propagation.

So, why did we use the dynamic imports previously? I believe it's because we used to call process.exit() in some of the CLI command implementations, and dynamically importing the functions helped work around that in the tests.

Testing Instructions

Unit tests should pass

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund requested review from a team, bcotrim and wojtekn January 2, 2026 12:13
@fredrikekelund fredrikekelund self-assigned this Jan 2, 2026

@nightnei nightnei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍
I restarted tests, it seems they are not relevant to the changes.

@fredrikekelund fredrikekelund merged commit 723ca1a into dev/studio-cli-i2 Jan 6, 2026
3 of 6 checks passed
@fredrikekelund fredrikekelund deleted the f26d/cli-static-test-imports branch January 6, 2026 08:39
@wojtekn

wojtekn commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for changing that - it will improve the developer and testing experience.

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.

3 participants