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

jest-preset-ts

v1.0.1

Published

A Jest preset geared towards TypeScript, Angular, and Node.js projects

Downloads

74

Readme

A Jest preset geared towards TypeScript, Angular, and Node.js projects

Table of Contents

Overview

This is a Jest preset that is used in all of the Megabyte Labs projects that use Jest. Jest is a JavaScript/TypeScript testing framework maintained by Facebook. This particular Jest preset is built with support for TypeScript, Node.js, and Angular in mind. It includes several Jest plugins as well as improved HTML reports. Out of the box, it lints .spec.ts files, runs the tests, and includes fancy reporting.

Requirements

If you are simply including this library in your project, all you need is a recent version of Node.js. Node.js >14.18.0 is sometimes required and is the only version range we actively support. Albeit, it is highly probable that lower versions will work as well depending on the requirements that this project imports.

Developer Requirements

The following versions of Node.js and Python are required for development:

Other versions may work, but only the above versions are supported. Most development dependencies are installed automatically by our Taskfile.yml set-up (even Node.js and Python). Run bash start.sh to install Bodega (an improved fork of go-task) and run the initialization sequence. The taskfiles will automatically install dependencies as they are needed, based on what development tasks you are running. For more information, check out the CONTRIBUTING.md or simply run:

npm run help

npm run help will ensure Bodega is installed and then open an interactive dialog where you can explore and learn about various developer commands.

Installation

To use this Jest preset/configuration in your project, first install the NPM package in your NPM project with:

npm install --save-dev jest-preset-ts

Then, add the configuration to your package.json file. Your package.json might look something like:

{
  "name": "mypackage",
  "version": "1.0.4"
  ...
  "jest": {
    "preset": "@megabytelabs/jest-preset",
    "reporters": [
      "default",
      [
        "jest-html-reporters",
        {
          "filename": "index.html",
          "openReport": true,
          "pageTitle": "Code Coverage Report",
          "publicPath": "./coverage"
        }
      ]
    ]
  }
}

There are of course other ways of including the Jest preset.

Usage

With the preset/configuration set up, you can now run jest commands and Jest will automatically detect and use the configuration stored in your package.json file. For instance, you can run Jest in watch mode with:

jest --watch

The Jest preset will scan your src/ directory for test files and show the results after every time you make a file change in --watch mode.

Plugins

This Jest preset/configuration includes all the best Jest plugins that have a decent amount of stars on GitHub. The plugins are listed below for your convenience:

| Jest Plugin | Description | | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | @jest-runner/electron | custom test runner for Jest that allows tests to be run in Electron environment | | @storybook/addon-storyshots | StoryShots adds automatic Jest Snapshot Testing for Storybook | | expect-puppeteer | Run the tests using Jest & Puppeteer | | jest-chain | Chain Jest matchers together to create one powerful assertion | | jest-dom | Custom jest matchers to test the state of the DOM | | jest-html-reporters | Jest test results processor for generating a summary in HTML | | jest-image-snapshot | Jest matcher for image comparisons | | jest-json-schema | JSON schema matcher for Jest | | jest-preset-angular | A preset of Jest configuration for Angular projects | | jest-puppeteer | Jest preset containing all required configuration for writing integration tests using Puppeteer | | jest-runner-eslint | ESLint runner for Jest | | jest-runner-groups | A custom runner that allows to tag test files and run groups of tests with Jest | | jest-runner-prettier | Prettier runner for Jest | | jest-runner-stylelint | Stylelint runner for Jest | | jest-runner-tsc | A Jest runner for the TypeScript compiler | | jest-watch-master | Jest watch plugin for checking changes since master | | jest-watch-select-projects | Select which Jest projects to run | | jest-watch-typeahead | Jest watch plugin for filtering test by file name or test name |

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page. If you would like to contribute, please take a look at the contributing guide.

Brian Zalewski

License

Copyright © 2020-2021 Megabyte LLC. This project is MIT licensed.