-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add commands to run tests and storybook in StrictMode #3352
base: canary
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@chirokas is attempting to deploy a commit to the NextUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe updates introduce stricter mode options for both development and testing environments through new scripts in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (3)
- package.json (7 hunks)
- packages/storybook/.storybook/main.js (1 hunks)
- scripts/setup-test.ts (2 hunks)
Additional comments not posted (6)
packages/storybook/.storybook/main.js (2)
23-23
: Stylistic Improvement: Trailing Comma AddedAdding a trailing comma after
disableTelemetry
is a good practice for cleaner diffs in version control systems.
18-20
: Implementation of Strict Mode in Storybook looks correct.The use of
process.env.STRICT_MODE === "true"
ensures that strict mode is only enabled when explicitly specified. This is a good practice to avoid unintentional activation.Verification successful
Implementation of Strict Mode in Storybook looks correct.
The use of
process.env.STRICT_MODE === "true"
ensures that strict mode is only enabled when explicitly specified. This is a good practice to avoid unintentional activation. The environment variableSTRICT_MODE
was correctly set to 'true' during the simulated run.
- The environment variable
STRICT_MODE
is properly set and utilized.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that STRICT_MODE environment variable is properly set when running Storybook. # Test: Check the environment variable during Storybook run. echo "Ensure that the STRICT_MODE environment variable is set to 'true' or 'false' as expected when running Storybook."Length of output: 246
Script:
#!/bin/bash # Description: Verify that STRICT_MODE environment variable is properly set and utilized during Storybook run. # Test: Check the environment variable during Storybook run. # We will simulate running Storybook and print the value of STRICT_MODE. # Note: This is a simulation and not the actual run of Storybook. # Set the environment variable for testing export STRICT_MODE="true" # Simulate running Storybook and check the environment variable node -e 'console.log("STRICT_MODE:", process.env.STRICT_MODE);'Length of output: 183
Script:
#!/bin/bash # Description: Verify that STRICT_MODE environment variable is properly set and utilized during Storybook run. # Test: Check the environment variable during Storybook run. # We will simulate running Storybook and print the value of STRICT_MODE. # Note: This is a simulation and not the actual run of Storybook. # Set the environment variable for testing export STRICT_MODE="true" # Simulate running Storybook and check the environment variable echo "STRICT_MODE: $STRICT_MODE"Length of output: 89
scripts/setup-test.ts (2)
2-2
: Correct Import for Test ConfigurationThe import of
configure
from@testing-library/react
is necessary for setting up the test environment. Ensure that it is used effectively in the rest of the file.Verification successful
Correct Import and Usage of
configure
The import of
configure
from@testing-library/react
is correctly implemented and used inscripts/setup-test.ts
.
- Line 2:
import { configure } from "@testing-library/react";
- Usage:
configure({ ... });
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `configure` in test setups. # Test: Search for `configure` usage in the file. rg --type ts "configure" ./scripts/setup-test.tsLength of output: 112
34-36
: Proper Configuration of Strict Mode in TestsSetting
reactStrictMode
based on theSTRICT_MODE
environment variable is a robust way to conditionally enable strict mode for tests.Verification successful
Proper Configuration of Strict Mode in Tests
Setting
reactStrictMode
based on theSTRICT_MODE
environment variable is a robust way to conditionally enable strict mode for tests. TheSTRICT_MODE
environment variable is properly set in thepackage.json
file for the relevant scripts.
package.json
:
"dev:strict": "cross-env STRICT_MODE=true pnpm dev"
"test:strict": "cross-env STRICT_MODE=true pnpm test"
scripts/setup-test.ts
:
reactStrictMode: process.env.STRICT_MODE === "true"
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that STRICT_MODE environment variable is properly set when running tests. # Test: Check the environment variable during test runs. echo "Ensure that the STRICT_MODE environment variable is set to 'true' or 'false' as expected when running tests."Length of output: 238
Script:
#!/bin/bash # Description: Verify that the STRICT_MODE environment variable is properly set when running tests. # Test: Check the value of the STRICT_MODE environment variable. # We will print the value of STRICT_MODE to ensure it is being set correctly. echo "STRICT_MODE is set to: $STRICT_MODE" # Additionally, we can list all environment variables to see if STRICT_MODE is present printenv | grep STRICT_MODELength of output: 163
Script:
#!/bin/bash # Description: Search for any occurrences of the STRICT_MODE environment variable in the codebase. # Search for STRICT_MODE in the codebase to verify its usage and setting. rg --fixed-strings "STRICT_MODE"Length of output: 251
package.json (2)
16-16
: New Scripts for Strict Mode ExecutionThe addition of
dev:strict
andtest:strict
scripts usingcross-env
to set theSTRICT_MODE
environment variable is a practical approach to enable strict mode. Ensure to test these scripts to verify they function as intended.Also applies to: 29-29
Line range hint
73-93
: Dependency Updates ReviewedUpdates to dependencies like
@storybook/react
,concurrently
, andcross-env
are important for maintaining project health. Verify that these updates do not introduce compatibility issues with existing code.Also applies to: 118-118, 123-136
Closes #
📝 Description
Developing in strict mode is the best practice for React because it helps teams catch bugs earlier.
⛳️ Current behavior (updates)
🚀 New behavior
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Summary by CodeRabbit