Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cinderblock opened this issue Jan 5, 2020 · 2 comments
Open

Comments

@cinderblock
Copy link

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
Copy link
Author

cinderblock commented Jan 5, 2020

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
Copy link

SandyLQ commented Feb 24, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants