eugene-manuilov / jest-runner-groups

A custom runner that allows to tag test files and run groups of tests with Jest.
MIT License
128 stars 14 forks source link

Unrecognized CLI Parameter: Unrecognized option "group". #12

Closed Vadorequest closed 4 years ago

Vadorequest commented 4 years ago

Running NODE_ENV=test jest --group utils --watchAll yields. I tried various variations like jest --group utils, but all yield the same.

jest  --group utils               
● Unrecognized CLI Parameter:

  Unrecognized option "group".

  CLI Options Documentation:
  https://jestjs.io/docs/en/cli.html

Commit: https://github.com/UnlyEd/next-right-now/pull/91/files

jest.config.js:

// This config cannot be used alongside package.json:jest, all Jest config must be centralised in this file - See https://github.com/facebook/jest/issues/10123#issuecomment-638796267
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  globals: {
    // XXX we must specify a custom tsconfig for tests because we need the typescript transform
    //  to transform jsx into js rather than leaving it jsx such as the next build requires.  you
    //  can see this setting in tsconfig.jest.json -> "jsx": "react"
    //  See https://github.com/vercel/next.js/issues/8663
    'ts-jest': {
      tsConfig: 'tsconfig.jest.json',
    },
  },
  modulePathIgnorePatterns: [
    'cypress',
  ],
  runner: 'groups', // Allow to use jest-runner-groups - See https://github.com/eugene-manuilov/jest-runner-groups#update-jest-config
  setupFilesAfterEnv: [
    'jest-extended', // See https://github.com/jest-community/jest-extended
    './jest.setup.js',
    './jest.extends.ts',
  ],
};

To reproduce:

  1. git clone https://github.com/UnlyEd/next-right-now.git nrn-quick-start
  2. cd nrn-quick-start && git checkout test-groups
  3. yarn test:group:utils
eugene-manuilov commented 4 years ago

hi @Vadorequest

can you try running NODE_ENV=test jest --group=utils --watchAll? Does it help?

Vadorequest commented 4 years ago
$ NODE_ENV=test jest --group=utils --watchAll
● Validation Error:

  Jest Runner groups cannot be found. Make sure the runner configuration option points to an existing node module.

Doesn't seem to change anything.

eugene-manuilov commented 4 years ago

@Vadorequest which version of jest do you use?

Vadorequest commented 4 years ago
 ✔  npx envinfo --preset jest
npx: installed 1 in 1.495s

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  npmPackages:
    jest: 26.0.1 => 26.0.1 
Vadorequest commented 4 years ago

@eugene-manuilov Any idea what's wrong? Stills stuck on this 😞

Vadorequest commented 4 years ago

To reproduce:

  1. git clone https://github.com/UnlyEd/next-right-now.git nrn-quick-start
  2. cd nrn-quick-start && git checkout test-groups
  3. yarn test:group:utils
Vadorequest commented 4 years ago

Ah, my bad. Doing NODE_ENV=test jest --group=utils --watchAll actually just worked out. 🤔

I must have done it wrong last time when you told me to try with = instead of space.

I'll try a bit more and close this if it's solved!

Vadorequest commented 4 years ago

Works perfectly!

https://github.com/UnlyEd/next-right-now/pull/91

Sorry for the noise.

eugene-manuilov commented 4 years ago

No worries, @Vadorequest! Glad it works for you! :yay: