0

My project structure:

    src
     - foo
       - test A
       - test B
       - test C
     - bar 
       ...

I ignore foo and not run testcases from there like discussed in this question:

    testPathIgnorePatterns: ['src/foo/'],

but because of reasons I want to run src/foo/test B

How can I achieve that? Neither of the following worked.

    testMatch: [
      '**/*.test.{ts,tsx,js,jsx}',
      'src/foo/test B',
    ],

testPathIgnorePatterns: ['src/foo/'],
  testMatch: [
    '**/*.test.{ts,tsx,js,jsx}',
    '!src/foo/**/*',
    'src/foo/test B',
  ],

til
  • 832
  • 11
  • 27

1 Answers1

0

The content of this array is interpreted as regex:

testPathIgnorePatterns: ['src/foo/']

therefore it's possible use a negative lookahead and specify which testfiles / paths which shall be executed:

testPathIgnorePatterns: [
    'src/foo/(?!test B)', 'src/bar/(?!some/other/path/test Y)'
]
til
  • 832
  • 11
  • 27