Jest Tests

Data Access Project

Data Access Project

Initialize Jest by running these commands

terminal : azure-quickstart/data-access
npm i -D jest typescript
npm i -D ts-jest @types/jest
npx ts-jest config:init

Confgure jest config

azure-quickstart/data-access/jest.config.js
module.exports = {
  roots: ["<rootDir>/."],
  preset: 'ts-jest',
  testEnvironment: 'node',
  testMatch: ['**/**/*.test.ts'],
    coverageReporters: ['json', 'lcov'],
    coverageDirectory: 'coverage',
    collectCoverageFrom: [
      "**/*.{js,jsx,ts}",
      "!**/node_modules/**",
      "!**/dist/**"
    ]
};

Configure package.json

Configure yaml

Configure .gitignore

References:

Last updated

Was this helpful?