Skip to content

TypeError: Cannot set property 'currentTest' of undefined #40

@jeremyhiggs

Description

@jeremyhiggs

When running jest with jest-allure installed, I often receive the above error. This did not use to happen, before using jest-allure.

Extended error message:

UserPreferences › can create an instance of the model from an arbitrary mock

TypeError: Cannot set property 'currentTest' of undefined

  at Allure.Object.<anonymous>.Allure.startCase (node_modules/allure-js-commons/index.js:44:23)
  at JasmineAllureReporter.specStarted (node_modules/jest-allure/dist/setup.js:24:21)

Package versions:

"jest": "^24.9.0",
"jest-allure": "^0.1.1",

Jest config (in package.json):

  "jest": {
    "collectCoverage": true,
    "coverageDirectory": "coverage",
    "preset": "jest-expo",
    "reporters": [
      "default"
    ],
    "setupFilesAfterEnv": [
      "jest-allure/dist/setup"
    ]
  }

I added a few console logs in jest-aalure/dist/setup.js:

FAIL models/tests/UserPreferences.test.js (98.219s)
● Console

console.error node_modules/jest-allure/dist/setup.js:23
  specStarted = skip NeedMock dummy
console.error node_modules/jest-allure/dist/setup.js:14
  startSuite = UserPreferences
console.error node_modules/jest-allure/dist/setup.js:23
  specStarted = can create an instance of the model from an arbitrary mock

It seems that startSuite is being called after specStarted, which would explain why Allure.startCase cannot find the suite. Any idea why this would be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions