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

@hvcgroep/design-system

v3.4.3

Published

## Usage

Downloads

542

Readme

HVC groep Design System

Usage

To use this package a written agreement has to be concluded with HVC. Without a written agreement you are not allowed to use this package in any way.

Testing

Our tests are written with (Jest)[https://jestjs.io/]. The tests are located in the component's root directory, so for example src/components/Accordion/index.test.tsx.

Snapshot tests

It's important that our components UI stays the same throughout changes in the codebase, and does not change unexpectedly. That's why we test them using snapshot tests. A typical snapshot test case renders a UI component, takes a snapshot, then compares it to a reference snapshot file stored alongside the test. The test will fail if the two snapshots do not match: either the change is unexpected, or the reference snapshot needs to be updated to the new version of the UI component.

We run all the tests in the testing pipeline. If a test fails, this will result in a failing pipeline and is a sign that there is a bug in the code, or a test needs to be regenerated.

You can run all the snapshot tests yourself, alongside other Jest tests, using the following command:

yarn run test

Or run a test for a specific component:

yarn run test src/components/Accordion

This command will run the test written in the index.test.tsx file. If your test file has a name other than index, you'll have to specify that file name in your command.

The terminal will output the test report and show you if the test succeeded or failed and why it failed. The output will look similar to this:

Success:

 PASS  src/components/Accordion/index.test.tsx
  Accordion
    ✓ renders correctly when not expanded (5 ms)
    ✓ renders correctly when expanded (1 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   2 passed, 2 total
Time:        2.456 s, estimated 3 s
Ran all test suites matching /src\/components\/Accordion/i.

Failure:

 FAIL  src/components/Accordion/index.test.tsx
  Accordion
    ✕ renders correctly when not expanded (6 ms)
    ✕ renders correctly when expanded

  ● Accordion › renders correctly when not expanded

    expect(received).toMatchSnapshot()

    Snapshot name: `Accordion renders correctly when not expanded 1`

    - Snapshot  - 3
    + Received  + 1

    @@ -15,10 +15,8 @@
        </button>
        <div
          className="faq-item__inner"
          id="section"
        >
    -     <div>
    -       Als je een slimme meter hebt, zullen wij de meterstand op 1 januari automatisch uitlezen. Als je een meter hebt die wij niet op afstand kunnen uitlezen, ontvang je van ons inderdaad een verzoek om de meterstand door te geven. Als je niet in staat bent de meterstand door te geven, zullen wij deze voor je schatten. We kunnen de meterstand achteraf niet aanpassen. Wij hebben de meterstand van 1 januari nodig zodat we het juiste verbruik tegen de juiste tarieven kunnen afrekenen op de jaarnota.
    -     </div>
    +     content
        </div>
      </article>

      13 |     ).toJSON();
      14 |
    > 15 |     expect(tree).toMatchSnapshot();
         |                  ^
      16 |   });
      17 |
      18 |   it('renders correctly when expanded', () => {

      at Object.<anonymous> (src/components/Accordion/index.test.tsx:15:18)

(Re)generate snapshot tests

If you make a change to a component that will cause the snapshot test to fail expectedly, you can regenerate the snapshot test using the command:

yarn run test:snapshot-generate <path-to-file>

This will update the existing test file to match the updated component UI state. You should only run this command if you've made intentional changes to the component or any component that depends on it. Otherwise, a failed test is a sign of a bug in the code.

All the generated snapshot tests will be stored in the directory __snapshots__.