Skip to content

Commands to run tests and storybook in StrictMode #3241

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

Merged
merged 6 commits into from
Jun 22, 2022
Merged

Commands to run tests and storybook in StrictMode #3241

merged 6 commits into from
Jun 22, 2022

Conversation

LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Jun 16, 2022

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

LFDanLu added 2 commits June 16, 2022 11:46
IMO better to have a single place to import all of out test utils, makes it easier to keep track
@LFDanLu LFDanLu changed the title (WIP) Strict mode (WIP) Commands to run tests and storybook in StrictMode Jun 16, 2022
@adobe-bot
Copy link

@adobe-bot
Copy link

@@ -48,29 +44,13 @@ function ProviderUpdater(props) {
return (
<Provider theme={theme} colorScheme={colorScheme} scale={scaleValue} locale={localeValue} toastPlacement={toastPositionValue}>
<main>
<div style={{position: 'absolute', paddingTop: '20px', paddingLeft: '20px', paddingRight: '20px'}}>
Copy link
Member Author

Choose a reason for hiding this comment

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

Clean up since we have a description tab in storybook now

@@ -13,7 +13,7 @@
import {ActionGroup, Item} from '../';
import {Provider} from '@react-spectrum/provider';
import React from 'react';
import {render} from '@testing-library/react';
import {render} from '@react-spectrum/test-utils';
Copy link
Member Author

Choose a reason for hiding this comment

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

Re-exported all the testing library commands from test-utils now that we are overriding render, renderHooks, and act. Makes it easier IMO to just export from one place

Comment on lines -13 to -19
let reactTestingLibrary = require('@testing-library/react');
export let renderHook = reactTestingLibrary.renderHook;
export let actHook = reactTestingLibrary.act;
if (!renderHook) {
let rhtl = require('@testing-library/react-hooks');
renderHook = rhtl.renderHook;
actHook = rhtl.act;
Copy link
Member Author

Choose a reason for hiding this comment

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

This stuff is moved to renderOverride.js

@LFDanLu LFDanLu changed the title (WIP) Commands to run tests and storybook in StrictMode Commands to run tests and storybook in StrictMode Jun 20, 2022
@LFDanLu LFDanLu marked this pull request as ready for review June 20, 2022 22:01
@adobe-bot
Copy link

@adobe-bot
Copy link

Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

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

LGTM, tested both locally and got expected runtime warnings and test failures for strict mode

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

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

Looks good. I think eventually we'll want to have a setup where we can opt individual components into strict mode, and/or run both. That way we can verify there are no regressions before we finish updating all the components to support it. But this is a good start, good to merge IMO.

@adobe-bot
Copy link

@LFDanLu LFDanLu merged commit a162e5b into main Jun 22, 2022
@LFDanLu LFDanLu deleted the strict_mode branch June 22, 2022 00:42
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.

4 participants