zaqqaz / jest-allure

Generate Allure Report for jest. Allure Report, a flexible lightweight multi-language test report tool with the possibility to add steps, attachments, parameters and so on.
MIT License
113 stars 38 forks source link

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

Open cinderblock opened 4 years ago

cinderblock commented 4 years ago

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'],
};
cinderblock commented 4 years ago

~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

SandyLQ commented 4 years ago

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..