@netlify/netlitest-helper
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

Netlitest-Helper

This is a test helper library built around the jest test runner and written in Typescript. The library provides helper methods to make writing tests as simple as possible, and to automatically inject variables for the various components necessary to make requests.

Available Methods

testBuilder

This is a generic method that accepts a javascript object with the following shape:

interface testOptions {
  component: string;
  method?: string;
  path: string;
  payload?: object;
  status?: number;
  snapshotResponsePayload?: boolean;
  snapshotResponseHeaders?: boolean;
  maxResponseTimeMS?: number;
  expectedHeadersValues?: object;
  name?: string;
}

Local Development

Below is a list of commands you will probably find useful.

npm start or yarn start

Runs the project in development/watch mode. netlitest-helper will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.

npm run build or yarn build

Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

npm test or yarn test

Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

/@netlify/netlitest-helper/

    Package Sidebar

    Install

    npm i @netlify/netlitest-helper

    Weekly Downloads

    4

    Version

    0.2.5

    License

    MIT

    Unpacked Size

    318 kB

    Total Files

    27

    Last publish

    Collaborators

    • seanroberts
    • biilmann
    • eduardoboucas
    • netlify-bot
    • akardet
    • sarahetter
    • mikewen
    • kathmbeck
    • hrishikeshk
    • vitaliyr
    • denar90
    • smnh
    • berdav
    • youvalv
    • serhalp-netlify
    • rmulligan-netlify