npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bliss-design-system/test-utils

v1.0.8

Published

Bliss Test Utils

Downloads

1

Readme

Test Utils

📦 Installation

To get access to the test utils in your app (unless it has already been installed) you can run the following command.

yarn add -D @bliss-design-system/test-utils

🏎 Usage

Each of the utilities that are provided as part of this library are described below. They address various needs for testing Bliss components in different testing scenarios.

mockBlissIcons

Our icons are currently built by creating an SVG sprite and working with the use attritube to pull the specific icon you need into a given use of the <bliss-icon> component. When using debuggers, specifically @testing-library's screen.debug() the full sprite sheet is rendered in apps making it difficult to quickly scan for the relevant piece of the debug output since it is pushed down by the sprite code.

To address the above issue we have provided a mock function which can be added as part of a setup phase for tests to mock a simplified version of the icon sprite which will prevent errors occurring in components referencing icons as well as greatly reduce the size of the sprite output to keep things focused on the relevant code you need to find when debugging.

Reduce sprite output

// setupAfterEnv.ts
mockBlissIcons('test-icon');

Testing for specific icon(s)

// YourComponent.test.ts
mockBlissIcons('info', 'action-dotted');

Shadow DOM traversal in @testing-library

A core aspect of Web Components (which is the technology powering all of the components found in @bliss-design-system/components) is the use of the Shadow DOM. The preferred testing approach used in in the Bryter application is @testing-library which currently doesn't traverse the Shadow DOM when using its many queries found on screen. We have added some prototypical functions to the technology which powers @testing-library to allow those queries to traverse the Shadow DOM.

To get this to work you need to import screen from @bliss-design-system/test-utils. It will work the same way as before and will have no effect on existing tests but in cases where Bliss Components are being used, those elements will also be queryable.

Our suggestion for implementing this alongside an existing use of @testing-library and avoiding confusion around "which screen is being imported" is to do the following:

shared-testing-goodness.ts

export * from '@testing-library';
export { screen } from '@bliss-design-system/test-utils';

Component.test.ts

import { screen, fireEvent, cleanup } from 'path/to/shared-testing-goodness';

// ... your tests

🫕 Contributing

If you'd like to contribute, please open an issue with your suggested change.

This issue will automatically be added to the Bliss Proposal Board. Once that is accepted, either the Bliss team will work on it or you can make changes locally by following the instructions and conventions in the individual package READMEs.

Reporting a bug

Notice something off? Please open an issue using our Bug Report template and fill in as many details as possible.

🙃 Troubleshooting

We'll fill this section out as we go and as issues are raised. But if you haven't found what you're looking for, get in touch via [email protected] or via the #bliss_support Slack channel ✨.