-
Notifications
You must be signed in to change notification settings - Fork 124
Compatibility with Mocha's parallel mode #967
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- String: the name of a well-known writer or the full path of a module exporting a class or instnce - Object with two keys: cls - the same as the above; args: arguments for class ctor
e2ebc51
to
2f72db4
Compare
epszaw
requested changes
May 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not able to compile the module due the following error:
λ yarn compile
src/index.ts → dist/index.mjs...
src/setupAllureMochaParallel.ts:3:45 - error TS7016: Could not find a declaration file for module 'mocha/lib/nodejs/reporters/parallel-buffered.js'. '/Users/epszaw/Code/Work/qameta/allure-js/.yarn/cache/mocha-npm-10.3.0-2a85896b70-8b30b3fdb3.zip/node_modules/mocha/lib/nodejs/reporters/parallel-buffered.js' implicitly has an 'any' type.
If the 'mocha' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mocha'
3 import { default as ParallelBuffered } from "mocha/lib/nodejs/reporters/parallel-buffered.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in src/setupAllureMochaParallel.ts:3
ERROR: "compile:types" exited with 2.
epszaw
approved these changes
May 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
theme:api
Javascript API related issue
theme:mocha
Mocha related issue
type:new feature
New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The PR allows Allure Mocha to be used with Mocha's
--parallel
mode. It does so by hooking into Mocha'sParallelBuffered
reporter'screateListeners
in a worker thread. Not perfect, but, you know, lesser of two evils.The patch is set up by introducing a new module into the list of modules Mocha requires at runtime (via
Mocha.MochaOptions.require
). The module only affects worker processes.Extra changes
New ways to pass a writer into the runtime
A writer can now be provided as a string or an array. That makes it easier to pass the config options across process boundaries.
Now, the following ways are supported:
The list of well-known classes is as follows:
AllureInMemoryAllureWriter
(all environments)FileSystemAllureWriter
(node.js only)AllureInMemoryWriter
(node.js only)MessageAllureWriter
(node.js only)The module must export either a writer class or an instance.
Currently, only CJS modules are supported. To support ESM modules, an async extension point is required somewhere in
allure-js-commons.
Since that's primarily a mechanism to test Allure integrations, we might not urgently need it.Fixes #619.
Checklist