Skip to content

Configuration

The Nijam Vitest reporter is configured by passing options to the NijamReporter constructor in vitest.config.ts. Only apiKey and projectId are required; everything else has a sensible default. Remember to set includeTaskLocation: true on test so Nijam can capture the failing line.

vitest.config.ts
import { defineConfig } from 'vitest/config';
import NijamReporter from '@nijam/vitest-reporter';
export default defineConfig({
test: {
includeTaskLocation: true,
reporters: [
'default',
new NijamReporter({
apiKey: process.env.NIJAM_API_KEY,
projectId: 'b4fdfc06-76a2-4721-89eb-9d070add8a5a',
}),
],
},
});
vitest.config.ts
new NijamReporter({
apiKey: process.env.NIJAM_API_KEY,
projectId: 'b4fdfc06-76a2-4721-89eb-9d070add8a5a',
apiUrl: process.env.NIJAM_API_URL, // default: https://api.nijam.dev
environment: process.env.DEPLOY_ENV, // free-form tag, e.g. "staging"
uploadSource: true, // upload test source for inline rendering
autoComplete: true, // finalize the run when the suite ends
silent: false, // suppress [nijam] log lines
});

All options are passed to the NijamReporter constructor.

OptionRequiredDefaultDescription
apiKeyyes-API key from the Nijam dashboard. Store it as a CI secret.
projectIdyes-The project’s ID (UUID) from the dashboard.
apiUrlnohttps://api.nijam.devAPI base URL. Also settable via NIJAM_API_URL. You don’t normally need to set this.
environmentno-Free-form deploy tag (e.g. "staging"). Adds a run filter. Runs without it show as Unset.
uploadSourcenotrueUpload test source so the dashboard renders tests inline. Set false to opt out.
autoCompletenotrueFinalize the run when the suite ends. Set false (or NIJAM_AUTO_COMPLETE=false) for fan-out CI.
silentnofalseSuppress all [nijam] log lines.

For environment, see Environments. For uploadSource, see Source. For autoComplete, see CI integration.

  • projectId - open your project in the dashboard and copy its Project ID.
  • apiKey - generate one in the project’s settings and set it as NIJAM_API_KEY in your CI secrets.

The reporter is built to never break your CI. If the API is unreachable, the key is wrong, or anything else goes sideways, it logs a [nijam] warning and lets the run finish exactly as it would without Nijam. Set silent: true to suppress even those warnings.

You don’t configure commit/branch/PR/author - the reporter auto-detects them from your CI provider’s environment variables, falling back to git.

@nijam/vitest-reporter also ships a nijam-vitest CLI. nijam-vitest fetch-failed asks Nijam which tests failed in the previous run so a retry runs only those, and clubs the attempts into one run on the dashboard. Vitest has no run-by-line, so it pairs the failing files with an exported test-name pattern:

Terminal window
npx nijam-vitest fetch-failed --output failed.txt --export-env "$GITHUB_ENV"
npx vitest run $(cat failed.txt) -t "$NIJAM_TEST_NAME_PATTERN"

It reuses your NIJAM_API_KEY and NIJAM_PROJECT_ID. See Re-run only failed tests for the full per-provider CI recipe.