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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alanizcreative/formation-coverage

v0.0.6

Published

Utility to generate code coverage reports for Playwright tests from TypeScript source code

Readme

Formation Coverage

Utility to generate code coverage reports for Playwright tests specifically for TypeScript source code.

Installation

npm install -D @alanizcreative/formation-coverage

TypeScript Configuration

Ensure your tsconfig.json includes the following compiler options to enable source map generation:

{
  "compilerOptions": {
    "sourceMap": true,
    "inlineSourceMap": false,
    "inlineSources": true
  }
}

setupCoverage

setupCoverage(args: CoverageConfig): Promise<void>

Set options and create coverage folder and file.

Parameters

  • args CoverageConfig required

Returns

Promise<void>

Examples

It's recommended to configure coverage options in your Playwright globalSetup file:

// tests/setup.ts

import { setupCoverage } from '@alanizcreative/formation-coverage/coverage.js'

export default async function () {
  await setupCoverage({
    dir: 'spec-coverage',
    file: 'spec-coverage.json',
    url: 'http://localhost:8000',
    outDir: 'spec',
    srcDir: 'src',
    reporters: [
      'text',
      'html'
    ],
    include: [
      'spec/components/**\/*.js',
      'spec/effects/**\/*.js',
      'spec/layouts/**\/*.js',
      'spec/objects/**\/*.js'
    ],
    exclude: [
      'spec/utils/**\/*.js',
      'spec/config/**\/*.js',
      'spec/tests/**\/*.js',
      'spec/**\/*.spec.js'
    ]
  })
}

doCoverage

doCoverage(browserName: string, page: Page, start?: boolean): Promise<void>

Start and end Playwright coverage and save to coverage file.

Parameters

  • browserName string required
    Coverage only applies to Chromium browsers.
  • page Page required
    Page object provided by Playwright.
  • start boolean optional
    Start or stop coverage.
    Default: true

Returns

Promise<void>

Examples

Use doCoverage before and after each test to capture coverage data:

// components/Navigation/__tests__/Navigation.spec.ts

import { test, expect } from '@playwright/test'
import { doCoverage } from '@alanizcreative/formation-coverage/coverage.js'

test.describe('Navigation', () => {
  test.beforeEach(async ({ browserName, page }) => {
    await doCoverage(browserName, page, true)
  })

  test.afterEach(async ({ browserName, page }) => {
    await doCoverage(browserName, page, false)
  })

  // Your test cases
})

createCoverageReport

createCoverageReport(): Promise<void>

Create coverage report from JSON data.

Returns

Promise<void>

Examples

Generate coverage reports after tests complete in your Playwright globalTeardown file:

// tests/teardown.ts

import { createCoverageReport } from '@alanizcreative/formation-coverage/coverage.js'

export default async function () {
  await createCoverageReport()
}

Types

CoverageConfig

Type: object

Properties

  • dir string optional
    Directory for coverage file and reports.
    Default: 'formation-coverage'
  • file string optional
    File name to store test coverage data.
    Default: 'formation-coverage.json'
  • url string optional
    Web server URL tests run on.
    Default: 'http://localhost:3000'
  • reporters ('text'|'html'|'lcov')[] optional
    Coverage report formats.
    Default: ['text']
  • outDir string optional
    Directory with compiled and source map files.
    Default: 'spec'
  • srcDir string optional
    Directory with source TypeScript files.
    Default: 'src'
  • include string[] optional
    Glob patterns to include in reports.
  • exclude string[] optional
    Glob patterns to exclude from reports.