craftz

Tests

The tests, one file for each part of the source.

Code

  • apply.test.ts

    Runs the read, write and read-back loop on parts that stand in for GitHub and Cloudflare, so each way a write can end is reported as it happened: fixed, still off, failed or left. A part already in line is never written.

  • cli.test.ts

    Runs craftz check and craftz fix from source on a package that pnpm new writes, after taking its prepack script out. check has to name the rule and fail, and fix has to put it back, so the command and pnpm align can't disagree on what a fix does.

  • index.test.ts

    Holds craftz() to never overriding the repository. Each case merges what the plugin returns into a config, the way Vite does. Unset keys are filled in and the repository's own stay.

  • new.test.ts

    Writes a package, a site, a package with a site, scripts in a private repository and an internal site in a public one, the way pnpm new does. Each is checked against the survey and runs its verify. If the rules change and the generator doesn't follow, this fails here, before a new repository starts out of line.

  • pr.test.ts

    Holds craftz pr and craftz gone to what they read from git and the notes config, without running git. The fix that moves a repository onto them is tested too, since it deletes files.

  • rules.test.ts

    Holds the rules and rules.ts to the same ids, so a rule can't be stated without a check, or checked without being stated. Every check, with an id or not yet, is under one of the doc's parts.

  • status.test.ts

    Holds what craftz status reads to the lines it prints: the latest run of each workflow, a build that's running or done, and npm's version next to the package's. Reading GitHub, npm and Cloudflare is left to running it.