-
Notifications
You must be signed in to change notification settings - Fork 119
-
Notifications
You must be signed in to change notification settings - Fork 119
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
allure-mocha: Cannot run example from docs since allure-runtime gives an undefined property #509
Comments
Thank you for the issue. It's strongly relates to #486 and depends on mochajs/mocha#4922 |
Actually, my colleague dug into this pretty heavily today, and she got it working! We discovered two causes. First, she discovered that the way the docs said to require the runtime was incorrect. Instead of:
She did this:
Then we could do We also discovered that it is because Mocha, or perhaps allure, wasn't able to handle both the default spec reporter and the allure-mocha reporter together. If we removed the spec reporter, then the runtime is defined. But with both, runtime.allure was undefined. We used the mocha-multi-reporter module to configure both reporters together. If you need more details on this please let me know. I do think it is worth updating the docs with this information, as it may help others. |
It depends on version of the packages. |
@epszaw if it helps, we are on the latest everything:
We do run tests in parallel, but we use a variation of a script shared by an allure collaborator: #245 (comment). The script splits up all of the spec files and runs them as separate, independent mocha processes. So we don't run into any of these issues when running in parallel. |
The original issue has been fixed for a lengthy time since 2.5.0 (see #730). The new version is used like this: import { it } from "mocha";
import { label } from "allure-js-commons";
it("bar", async () => {
await label("foo", "bar");
}); The legacy version is also available (note the absence of the import { it } from "mocha";
import { allure } from "allure-mocha/runtime";
it("bar", async () => {
await allure.label("foo", "bar");
}); |
Describe the bug
When attempting to use the simple example from the readme, we discovered that the
allure
variable is undefined, so we cannot call any of the "extra information" methods, such assteps
andattachments
.To Reproduce
Steps to reproduce the behavior:
npm test
allure
is undefined.Expected behavior
According to the documentation, if we want to add extra information to the report, we can import allure/runtime and then use methods, such as allure.epic, story, description, etc. We expect the tests to complete, with one passing and one failing and for the extra information to appear in the report.
Desktop (please complete the following information):
We are running Node.js v16.17 and allure-mocha 2.0.0-beta.19
Additional context
See the Usage section of the docs to see the instructions.
Stacktrace:
The text was updated successfully, but these errors were encountered: