Skip to content
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

fix(sandpack-tests): introduce hideTestsAndSupressLogs prop #775

Merged
merged 8 commits into from
Feb 28, 2023

Conversation

ubeytd
Copy link
Contributor

@ubeytd ubeytd commented Feb 28, 2023

What kind of change does this pull request introduce?

This pull request introduces a new feature to SandpackProvider options.

Specifically, it adds the ability to hide test files and suppress their output from being logged to the console when a test fails.

Additionally, it allows for the hiding of the verbose and watch buttons from the test console and prevents opening test files with test links from the console.

What is the current behavior?

Currently, there is no option to hide test files or suppress their output when they fail in the SandpackProvider options. And, there is no option to hide the verbose or watch buttons from the tests console.

Also when the user clicks on the test file path, even if it is hidden, the editor will open the test file.

What is the new behavior?

With this feature, a hideTestsAndSupressLogs option is added to the SandpackProvider options.

When set to true, this option hides test files and suppresses their output from being logged to the console when a test fails.

Also, it will prevent opening test files in the editor, if the user clicks on the path link on the console.

Additionally, hideVerboseButton and hideWatchButton options are added to the SandpackTests component to allow the hiding of the verbose and watch buttons from the tests console.

What steps did you take to test this?

To test this feature, the following steps were taken:

  1. Added the HiddenTests component to Storybook.
  2. Set hideTestsAndSupressLogs to true and ran a test that was expected to fail.
  3. Confirmed that the test file was hidden and its output was suppressed from the console.
  4. Set hideVerboseButton and hideWatchButton to true and confirmed that the buttons were hidden from the tests console.

Checklist

  • Documentation;
  • Storybook (if applicable);
  • Tests;
  • Ready to be merged;

Closes #768

Thank you for considering this feature. 🤗
I believe it will be useful for the users of codesandbox/sandpack who want to hide tests completely.
Please let me know if you would like me to add & change code/docs for this feature 💪🏻

@vercel
Copy link

vercel bot commented Feb 28, 2023

@ubeytd is attempting to deploy a commit to the CodeSandbox Team on Vercel.

A member of the Team first needs to authorize it.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 28, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 250f798:

Sandbox Source
Sandpack Configuration
sandpack 2 example not updating with customSetup and files in the provider Configuration

@ubeytd ubeytd mentioned this pull request Feb 28, 2023
2 tasks
Copy link
Member

@danilowoz danilowoz left a comment

Choose a reason for hiding this comment

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

Thank you! It looks promising.

sandpack-react/src/components/Tests/Header.tsx Outdated Show resolved Hide resolved
sandpack-react/src/components/Tests/Header.tsx Outdated Show resolved Hide resolved
sandpack-react/src/components/Tests/Header.tsx Outdated Show resolved Hide resolved
sandpack-react/src/components/Tests/Specs.tsx Outdated Show resolved Hide resolved
sandpack-react/src/components/Tests/Specs.tsx Outdated Show resolved Hide resolved
website/docs/src/pages/advanced-usage/components.mdx Outdated Show resolved Hide resolved
website/docs/src/pages/advanced-usage/components.mdx Outdated Show resolved Hide resolved
website/docs/src/pages/advanced-usage/components.mdx Outdated Show resolved Hide resolved
website/docs/src/pages/advanced-usage/components.mdx Outdated Show resolved Hide resolved
@ubeytd
Copy link
Contributor Author

ubeytd commented Feb 28, 2023

CleanShot 2023-02-28 at 19 27 43@2x

Working with docs is not super easy due to this error, is it a known error?

Copy link
Member

@danilowoz danilowoz left a comment

Choose a reason for hiding this comment

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

It looks good! Just a few tweaks and it's ready to go

sandpack-react/src/components/Tests/SandpackTests.tsx Outdated Show resolved Hide resolved
sandpack-react/src/components/Tests/Header.tsx Outdated Show resolved Hide resolved
@ubeytd ubeytd changed the title Feature/test hiding options feat: test hiding options Feb 28, 2023
@ubeytd
Copy link
Contributor Author

ubeytd commented Feb 28, 2023

Awesome! Thanks for guiding me all the way 💪🏻

@danilowoz danilowoz changed the title feat: test hiding options fix(sandpack-tests): introduce hideTestsAndSupressLogs prop Feb 28, 2023
@vercel
Copy link

vercel bot commented Feb 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
sandpack-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 28, 2023 at 2:32PM (UTC)

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.

👀 Hiding Sandpack Tests
2 participants