How JavaScript projects are usually set up, built and tested. Always prefer the project's own CONTRIBUTING.md when it says something different.
Open JavaScript issues: JavaScript issue list · TypeScript issues
- Install Node.js with a version manager such as fnm or nvm, using the version in
.nvmrc,.node-versionorenginesinpackage.json. - Run
corepack enableso the project's pinned package manager (packageManagerinpackage.json: npm, pnpm or Yarn) is used automatically.
| Task | Usual command |
|---|---|
| Install dependencies | npm ci, pnpm install --frozen-lockfile or yarn install --immutable (match the lockfile) |
| Run tests | npm test, or the test script in package.json (Vitest, Jest, Mocha, node:test) |
| Run one test file | npx vitest run path/to/file.test.js or npx jest path/to/file.test.js |
| Lint and format | npm run lint, npx eslint ., npx prettier --check . |
| Build | npm run build |
- Look at the
scriptssection ofpackage.json: it is the project's real command list. - Use the package manager the lockfile belongs to (
package-lock.json,pnpm-lock.yaml,yarn.lock,bun.lock). Mixing them creates noisy lockfile changes reviewers will reject. - In monorepos (a
packages/folder,pnpm-workspace.yaml, Nx, Turborepo), run commands for one package, for examplepnpm --filter <name> test. - Many projects need a changeset (
npx changeset) or Conventional Commit titles for releases.
- Tests for the area you changed pass locally.
- Formatter and linter pass with the project's configuration.
- Your diff contains no unrelated formatting or lockfile changes.
Back to all languages · Guide