zaqqaz/jest-allure

Your test suite must contain at least one test with setup script

cinderblock opened this issue · 2 comments

I can't get this to work with latest stable jest (24.9.0).

If I use setupFilesAfterEnv or import 'jest-allure/dist/setup' manually, my tests do not run and jest detects 0 tests:

> jest

 FAIL  tests/main.ts
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at node_modules/@jest/core/build/TestScheduler.js:242:24
      at asyncGeneratorStep (node_modules/@jest/core/build/TestScheduler.js:131:24)
      at _next (node_modules/@jest/core/build/TestScheduler.js:151:9)
      at node_modules/@jest/core/build/TestScheduler.js:156:7
      at node_modules/@jest/core/build/TestScheduler.js:148:12
      at onResult (node_modules/@jest/core/build/TestScheduler.js:271:25)

----------|----------|----------|----------|----------|-------------------|
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
 main.ts  |        0 |      100 |        0 |        0 |... 12,13,15,17,21 |
 wait.ts  |        0 |        0 |        0 |        0 |         1,2,3,4,7 |
----------|----------|----------|----------|----------|-------------------|

If I comment them out, my tests pass.

I have tried putting the import at the end of my tests.

jest.config.js

module.exports = {
  clearMocks: true,
  moduleFileExtensions: ['ts', 'js'],
  testEnvironment: 'node',
  // testRunner: 'jest-circus/runner', // Not compatible with jest-allure
  transform: { '^.+\\.ts$': 'ts-jest' },
  collectCoverage: true,
  collectCoverageFrom: ['src/**/*.ts'],
  testRegex: '(/tests/[^/]+)\\.ts$',
  verbose: true,
  setupFilesAfterEnv: ['jest-allure/dist/setup'],
};

Ooops. This is a dupe of #5

Leaving this open since I think that one should be reopened

Edit:

This looks like a regression because #5 was supposed to fix this issue if I understand correctly

I am facing the same issue that it cannot find the tests after i added this setupFilesAfterEnv: ['jest-allure/dist/setup'], if I remove it it can find the test....

Just for the people with the same issues, according the comment above, at least using "describe" instead of only "test" can solve the problem for now..