allwright
← All posts
3 min readThe allwright team

npm init allwright: a test project in one command

allwright now ships its own project initializer. Run npm init allwright@latest and get a working, installed TypeScript or JavaScript test project — config, starter tests, and all — in under a minute.

clitypescriptjavascriptgetting-startedvitestweb testing
scaffold$npm init allwright@latest✔ TypeScript ✔ Web✔ installed with npmOne commandpackage.jsonallwright.config.yamlvitest.config.tstests/web.spec.tsWorking project, ready to run

Our TypeScript getting-started guide walks through six steps to go from an empty folder to a passing test: initialize the project, install @allwright.dev/vitest, write a tsconfig.json, write a vitest.config.ts, write the test, run it. Every step is correct and every step is boilerplate you shouldn't have to type by hand. As of create-allwright@0.0.60, you don't:

npm init allwright@latest

One command, and you have a working project — config, a starter test, and dependencies installed.

What it does

npm init allwright@latest (or npm create allwright@latest, same package) asks two questions and scaffolds a project from the answers:

  • TypeScript or JavaScript.
  • Which surfaces you want to testWeb, Mobile Android, or both.

From there it writes a small, real project, not a maze of generated files:

.
├── tests/
│   ├── web.spec.ts        # if Web is selected
│   └── mobile.spec.ts     # if Mobile Android is selected
├── allwright.config.yaml
├── vitest.config.ts
├── tsconfig.json          # TypeScript projects only
├── package.json
└── README.md

vitest.config.ts is already wrapped in allwrightVitestConfig, allwright.config.yaml is already pointed at the surfaces you picked, and each spec file is a real, runnable test against a public demo target — the same themoderninternet site and Airticket demo app used throughout our other guides — so npm test passes immediately, before you've changed a single line.

Then it detects your package manager — from an existing lockfile if you have one (bun.lock, pnpm-lock.yaml, yarn.lock, package-lock.json), falling back to whichever manager invoked the initializer — and runs the install for you. By the time the command finishes, node_modules is already there.

Non-interactive use

Every prompt has a flag, so CI, scripts, and anyone who'd rather not answer questions can skip the interactive session entirely:

npm init allwright@latest my-app -- --typescript --web --no-install
FlagDoes
--yes / -yAccept defaults (TypeScript, Web) without prompting
--typescript / --tsSkip the language prompt
--javascript / --jsSkip the language prompt
--webInclude the web surface
--mobile / --mobile-androidInclude the Android surface
--bothInclude web and Android
--surface <id>Add one surface by id, repeatable
--package-manager <bun|npm|pnpm|yarn>Override auto-detection
--no-installScaffold without installing dependencies
--forceOverwrite files in a non-empty target directory without asking

A target directory is the one positional argument — omit it to scaffold into the current folder.

Try it

npm init allwright@latest my-app
cd my-app
npm test

That's the same passing test the six-step manual walkthrough in our getting-started guide ends on, minus every step in between. The manual guide is still the right read if you want to understand what each generated file is actually doing, or you're wiring allwright into an existing project instead of starting a new one — the initializer is for the blank-folder case specifically.

Where to go next

Try it in your own project

allwright is building in public. Star the repo to track progress, or keep reading the rest of the blog.