noflake init

Initialize NoFlake in your project. Sets up configuration, directories, and optional git hooks.

āœ… Available in v0.0.x

Usage

npx noflake init [options]

Options

FlagDescriptionDefault
--hookInstall a post-commit git hook for auto-updatesfalse

What it does

  1. Creates .noflake/ directory — State folder for test manifests, plans, and run history
  2. Generates .noflakerc.json — Configuration file with sensible defaults for your project
  3. Creates tests/e2e/ — Directory where generated tests will live
  4. Updates .gitignore — Adds run history to .gitignore (ephemeral data)
  5. Generates playwright.config.ts — If you don't have one, creates a config targeting tests/e2e/ with Chrome, screenshots on failure, and a dev server
  6. Installs git hook (with --hook) — A post-commit hook that runs noflake update automatically

Example

$ npx noflake init --hook

šŸ”„ NoFlake — Init

  āœ… Created .noflakerc.json
  āœ… Created tests/e2e/
  āœ… Updated .gitignore
  āœ… Created playwright.config.ts
  āœ… Installed post-commit hook

šŸŽ‰ NoFlake initialized!

  Next steps:
    noflake write   — Generate your test suite
    noflake run     — Run tests and get a report
    noflake update  — Patch tests after code changes

Generated Playwright Config

The generated playwright.config.ts includes:

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests/e2e',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: [
    ['json', { outputFile: '.noflake/playwright-results.json' }],
    ['html']
  ],
  use: {
    baseURL: 'http://localhost:3000',
    trace: 'on-first-retry',
    screenshot: 'only-on-failure',
  },
  projects: [
    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
  ],
  webServer: {
    command: 'npm run dev',
    url: 'http://localhost:3000',
    reuseExistingServer: !process.env.CI,
  },
});