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

@cfpreview/pages-e2e-test-runner-cli

v0.0.25

Published

## Fixtures vs. Features

Readme

Pages e2e tests

Fixtures vs. Features

A fixture is the skeleton of a Pages project. You'll usually want a fixture to be the source code of a framework starter/template. However, you can create more dynamic fixtures which are mostly empty, and automatically run a command (e.g. npx create-react-app@latest) to bootstrap it instead. Together, this functionality allows you to create fixtures which test historic versions of frameworks, as well as current and upcoming versions.

A feature, on the other hand, is some sort of transformation you do to a fixture. For example, you can add a new page to your fixture which would demonstrates a particular feature of the framework in use. Features are broken out of fixtures so that they can be applied easily across multiple fixtures without copy-pasting, and so updating them is made much easier.

Fixtures and features can each have their own tests.

Adding a new fixture

  1. Create a /pages-e2e/fixtures/<name-of-fixture>/ directory. Populate it with your fixture. You may want to remove any tests and testing config if any came with the project when bootstrapping with something like create-react-app.

  2. Add any test files to this directory that you want to run against the fixture. More on how to write the tests below.

  3. Create a /pages-e2e/fixtures/<name-of-test>/main.fixture file:

    {
    	"features": ["list-of-features", "you-want-to-apply", "to-this-fixture"],
    	// Any bootstrapping command you want to run before triggering a build on the fixture
    	"setup": "npx create-react-app@latest",
    	"buildConfig": {
    		"buildCommand": "echo \"hi\"",
    		"buildOutputDirectory": "public"
    	}
    }

Adding a new feature

Features are given the following environment variables:

  • WORKSPACE_DIR, the fixture directory that is being used in this test run.
  1. Create a /pages-e2e/features/<name-of-feature>/main.feature file:

    {
    	// Any bootstrapping command you want to run in order to apply this feature to the fixture
    	"setup": "mkdir -p ${WORKSPACE_DIR}/functions && cp assets/functions-date.ts ${WORKSPACE_DIR}/functions/date.ts"
    }

An example of running TypeScript in a setup command can be found in the next-pages-experimental-edge-api-route feature.

Writing a test

Any **/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx} files in the fixture or applied feature directories will be run with Vitest. Tests are given the following environment variables:

  • DEPLOYMENT_URL, the URL of the deployed site. We've already validated that this is live, so you're free to immediately start hitting it. It does not have a trailing slash.

Here's a simple test which asserts the deployment contains the string "Hello, world!":

import { describe, it } from "vitest";

describe("Simple HTML project", () => {
	it("should say 'Hello, world!' at the root", async ({ expect }) => {
		const response = await fetch(`${DEPLOYMENT_URL}/`);
		expect(await response.text()).toContain("Hello, world!");
	});
});

Additionally, tests in the /pages-e2e/__tests__/ directory are run globally on every fixture.

How does this work?

  1. Creates a Git repo locally, checks out a new orphan branch, with the fixture contents.
  2. Runs make setup.
  3. Runs make setup for each of the features defined in the fixture Makefile.
  4. Git commits and pushes to a repo which is connected to a Pages Project which has auto deployments disabled.
  5. Creates a Deploy Hook for that branch and triggers it.
  6. Waits the Deployment to be live.
  7. Runs the fixture and feature tests.
  8. Uploads the test report as another Deployment.
  9. Deletes the Deploy Hook and Git branch.

Roadmap

  • [x] Apply Cloudflare_CA.pem

  • [x] Pretty results

  • [x] Allow custom build output directories

  • [x] Matrix mode

    • [x] Matrix reporting
    • [x] Matrix running
    • [x] Lock service
  • [ ] Local mode using Wrangler

  • [ ] Staging mode

  • [ ] Direct Upload mode

  • [x] Decent logging

  • [x] Allow customizable deployment config per fixture

  • [ ] Migrate security test

  • [ ] Populate with a selection of framework fixtures

  • [ ] Move to TeamCity and configure cron

  • [ ] Alert failures

  • [ ] Make it easier to add new types of bindings

  • [ ] Error when there's a conflict on binding names

Optional nice-to-haves

  • [ ] Extend vitest matchers when using Playwright

  • VARIANTS