nb source test

Run tests in the selected app directory. Before running tests, the CLI recreates a built-in Docker test database and injects internal DB_* environment variables.

Usage

nb source test [paths...] [flags]

Parameters

ParameterTypeDescription
[paths...]string[]Test file paths or globs passed through to the test runner
--cwd, -cstringApp directory where tests run; defaults to the current directory
--watch, -wbooleanRun Vitest in watch mode
--runbooleanRun once without entering watch mode
--allowOnlybooleanAllow .only tests
--bailbooleanStop after the first failure
--coveragebooleanEnable coverage report
--single-threadstringPass single-thread mode through to the underlying test runner
--serverbooleanForce server test mode
--clientbooleanForce client test mode
--db-clean, -dbooleanClean the database when supported by the underlying app command
--db-dialectstringBuilt-in test database dialect: postgres, mysql, mariadb, or kingbase
--db-imagestringBuilt-in test database Docker image
--db-portstringTCP port where the built-in test database is published on the host
--db-databasestringDatabase name injected for tests
--db-userstringDatabase user injected for tests
--db-passwordstringDatabase password injected for tests
--verbosebooleanShow underlying Docker and test runner output

Examples

nb source test
nb source test --cwd /path/to/app
nb source test packages/core/server/src/__tests__/foo.test.ts
nb source test --server --coverage
nb source test --db-port 5433