add SHOPIFY_CLI_ENV=development for test commands#6998
Merged
phyllis-sy-wu merged 1 commit intomainfrom Mar 19, 2026
Merged
Conversation
Contributor
Coverage report
Test suite run success3910 tests passing in 1502 suites. Report generated by 🧪jest coverage report action from 193147e |
ryancbahan
reviewed
Mar 12, 2026
ryancbahan
reviewed
Mar 12, 2026
Contributor
ryancbahan
left a comment
There was a problem hiding this comment.
nice job! let's just make sure all the package.json commands that need this env var have it
13bbcda to
cdbf4d0
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates local test entrypoints to run under the development Shopify CLI environment so behavior/config matches dev test.
Changes:
- Prefixes the root
pnpm testscript withSHOPIFY_CLI_ENV=developmentwhen runningvitest. - Adjusts
dev.yml’stestcommand to callpnpm run test(instead oftest:unit).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Updates root test script to run vitest with SHOPIFY_CLI_ENV=development (and removes test:unit). |
| dev.yml | Switches dev test to invoke pnpm run test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cdbf4d0 to
193147e
Compare
ryancbahan
approved these changes
Mar 19, 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.

WHY are these changes introduced?
Some unit tests fail when
SHOPIFY_CLI_ENV=developmentis not set. Specifically, four tests in theremoveDuplicatedPluginssuite inbase-command.test.tsdepend onBaseCommand.init()skippingregisterCleanBugsnagErrorsFromWithinPlugins(which only runs when not in development mode). Without this skip, that function runs against mock plugins that have norootproperty, throws beforeremoveDuplicatedPluginscan execute, and the assertions fail.Relevant discussion: https://shopify.slack.com/archives/C05E3BDFDRB/p1773343132505319
Context
There are three ways to run unit tests locally:
dev testSHOPIFY_CLI_ENV=developmentis already set in dev.yml, so tests pass afterdev up.pnpm testSHOPIFY_CLI_ENV=development, so four tests failed unless the caller exported the variable manually.pnpm vitest runSHOPIFY_CLI_ENV=development.WHAT is this pull request doing?
SHOPIFY_CLI_ENV: 'development'invite.config.tsundertest.env, so the variable is applied to all vitest invocations (pnpm test,pnpm vitest run, and CI) on all platforms — without requiring a shell prefix or additional dependencies likecross-env.test:unitscript. After cucumber tests were removed,testandtest:unitbecame identical (pnpm vitest run). Keeping both caused confusion with no benefit..github/workflows/tests-manual.ymlto referencepnpm testinstead of the removedpnpm test:unit.How to test your changes?
Run the commands below on different branches:
On
main- reproduce the failure:Output: 4 tests fail in
base-command.test.ts > removeDuplicatedPluginsOn this branch - verify the fix:
Output: all tests pass
Measuring impact
How do we know this change was effective? Please choose one:
Checklist