Skip to content

Latest commit

 

History

History
102 lines (79 loc) · 1.6 KB

File metadata and controls

102 lines (79 loc) · 1.6 KB

TDD Guard Jest Reporter

Jest reporter that captures test results for TDD Guard validation.

Requirements

  • Node.js 18+
  • Jest 30.0.5+
  • TDD Guard installed globally

Installation

npm install --save-dev tdd-guard-jest

Configuration

Jest Configuration

Add the reporter to your jest.config.js:

module.exports = {
  reporters: [
    'default',
    [
      'tdd-guard-jest',
      {
        projectRoot: __dirname,
      },
    ],
  ],
}

Or in jest.config.ts:

import type { Config } from 'jest'
import path from 'path'

const config: Config = {
  reporters: [
    'default',
    [
      'tdd-guard-jest',
      {
        projectRoot: path.resolve(__dirname),
      },
    ],
  ],
}

export default config

Workspace/Monorepo Configuration

For workspaces or monorepos, pass the project root path to the reporter:

// jest.config.js in project root
const path = require('path')

module.exports = {
  reporters: [
    'default',
    [
      'tdd-guard-jest',
      {
        projectRoot: path.resolve(__dirname),
      },
    ],
  ],
}

If your jest config is in a workspace subdirectory, pass the absolute path to your project root:

module.exports = {
  reporters: [
    'default',
    [
      'tdd-guard-jest',
      {
        projectRoot: '/Users/username/projects/my-app',
      },
    ],
  ],
}

More Information

License

MIT