microsoft / microsoft/azure-devops-extension-sdk

Error when I execute `jest`

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
159
Forks
53
PR merge metrics
No merged PRs in 30d

Description

In my jest.config.js

module.exports = {
  projects: [
    './jest.config.test.js',
    './jest.config.eslint.js',
    './jest.config.firestore.js',
  ],
  transform: {
    // '^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { rootMode: 'upward' }],
    '^.+\\.(ts|tsx)?$': 'ts-jest',
    '^.+\\.(js|jsx)$': 'babel-jest',
  },
  transformIgnorePatterns: [
    '/node_modules/(?!@hookform/*).+\\.[tj]sx?$',
    'node_modules/(?!(azure-devops-ui|azure-devops-extension-sdk)/)',
  ],
  watchPlugins: [
    'jest-watch-typeahead/filename',
    'jest-watch-typeahead/testname',
    'jest-watch-select-projects',
  ],
};

And my jest.config.test.js

module.exports = {
  displayName: 'test',
  rootDir: 'src/',
  clearMocks: true,
  errorOnDeprecated: true,
  testEnvironment: 'jsdom',
  coverageDirectory: '<rootDir>/../coverage/',
  collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx}', '<rootDir>/**/*.{js,jsx}'],
  coveragePathIgnorePatterns: [
    '/node_modules/',
    '/__mocks__/',
    '/mocks/',
    '/@types/',
    '/public/',
  ],
  setupFilesAfterEnv: ['<rootDir>/../jest.setup.ts'],
  testMatch: ['<rootDir>/**/*.test.[tj]s?(x)'],
  notify: true,
  notifyMode: 'failure-change',
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
  transformIgnorePatterns: [
    '/node_modules/(?!@hookform/*).+\\.[tj]sx?$',
    'node_modules/(?!(azure-devops-ui|azure-devops-extension-sdk)/)',
  ],
  preset: 'ts-jest/presets/js-with-ts',
  moduleNameMapper: {
    '@babel/core/lib/config/files/index-browser.js':
      '@babel/core/lib/config/files/index.js',
    '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
      '<rootDir>/__mocks__/fileMock.ts',
    '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
  },
};
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running jest with the shown jest.config.js and capture the full error, since the issue only provides a screenshot. Compare the project entries in jest.config.test.js, jest.config.eslint.js, and jest.config.firestore.js, then confirm that Jest runs successfully across the configured projects without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.