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

@lowgular/jestgular

v0.1.12

Published

Framework for unit / feature / acceptance testing of your Angular code.

Downloads

377

Readme

Jestgular

Framework for unit / feature / acceptance testing of your Angular code.

Dependencies

Two hard dependencies (as the name suggests) are: Jest and Angular, however the idea is that you do not need to understand anything about neither Jest nor Angular because the API of the framework should be declarative, self-explanatory and searchable so that developer can easily get up to date with it.

Core Concepts

Setup

Setting up TestBed in Angular can be quite complicated and requires a lot of knowledge about testing in general.

It is helpful to understand the pyramid of testing, quadrants of testing and test desiderata, however with jestgular you do not have to worry about it so much because it provides you with helpful setup factories to get you started:

  • givenStandaloneComponent: provide standalone compnent and optionally apply function that will modify underlying component instance

TODO:

- givenApp for acceptance testing
- givenNgrxState
- givenPipe
- givenDirective

ElementLocator

It is an abstraction that allows you to instantiate specific elements. You can use one of the locating methods:

  • locateChild - locates single element

_ TODO _

- locateList - locates many elements
- locateTable - table specific locator

ElementSelector

You can select elements by different criteria, in order to do so use one of the following selector functions

  • cssSelector - select by css
  • altSelector - select by alt attribute
  • placeholderSelector - select by placeholder attribute
  • testIdSelector - select by data-testid attribute
  • textSelector - select by exact text content
  • labelSelector - select input by label
    • link label's for attribute with input id attribute
    • find first input in content of label

TODO

- buttonRoleSelector

You can also provide just a string which will fall back to cssSelector

TODO

Add support for regexp as selector value - currently only string is allowed

Elements

There are plenty of elements that are abstractions of HTMLElement and DebugElement and give you nice API to interact (when) and expect (then).

_ TODO _

Add support for component harness instead of manually operating on native elements

Interacting should depends on the exact element that you are using, so play around with it.

Expecting on the element is based on RegExp, which means that you can expect values using regexp. You can also provide string, which will fall back into exact regexp.

Examples of elements are:

  • SimpleElement (most basic html element that has attributes)
  • TextElement (can have content)
  • ImageElement (has special attribute src)
  • FormControlElement (input text / number)

TODO

- ListElement
- TableElement
- CheckboxElement
- RadioGroupElement
- CheckboxGroupElement