Skip to content

Commit

Permalink
Fix allure-mocha parallel for ESM runner
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Jun 6, 2024
1 parent 7628044 commit 0f269e3
Show file tree
Hide file tree
Showing 14 changed files with 189 additions and 3 deletions.
94 changes: 94 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/allure-mocha/babel.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
["@babel/preset-env", { "modules": "commonjs" }]
],
"plugins": ["babel-plugin-add-module-exports"],
"plugins": ["babel-plugin-add-module-exports", "babel-plugin-transform-import-meta"],
"targets": {
"esmodules": false,
"node": 18
Expand Down
1 change: 1 addition & 0 deletions packages/allure-mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-transform-import-meta": "^2.2.1",
"chai": "^4.3.8",
"chai-like": "^1.1.1",
"chai-things": "^0.2.0",
Expand Down
8 changes: 6 additions & 2 deletions packages/allure-mocha/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import type * as Mocha from "mocha";
import { hostname } from "node:os";
import { extname, join } from "node:path";
import { dirname, extname, join } from "node:path";
import { env, pid } from "node:process";
import { fileURLToPath } from "node:url";
import { isMainThread, threadId } from "node:worker_threads";
import type { Label } from "allure-js-commons";
import { LabelName } from "allure-js-commons";

const filename = fileURLToPath(import.meta.url);

export const getSuitesOfMochaTest = (test: Mocha.Test) => test.titlePath().slice(0, -1);

export const resolveParallelModeSetupFile = () => join(__dirname, `setupAllureMochaParallel${extname(__filename)}`);
export const resolveParallelModeSetupFile = () =>
join(dirname(filename), `setupAllureMochaParallel${extname(filename)}`);

export const resolveMochaWorkerId = () => env.MOCHA_WORKER_ID ?? (isMainThread ? pid : threadId).toString();

Expand Down
87 changes: 87 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ __metadata:
languageName: node
linkType: hard

"@babel/code-frame@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/code-frame@npm:7.24.7"
dependencies:
"@babel/highlight": "npm:^7.24.7"
picocolors: "npm:^1.0.0"
checksum: 10/4812e94885ba7e3213d49583a155fdffb05292330f0a9b2c41b49288da70cf3c746a3fda0bf1074041a6d741c33f8d7be24be5e96f41ef77395eeddc5c9ff624
languageName: node
linkType: hard

"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.24.6":
version: 7.24.6
resolution: "@babel/compat-data@npm:7.24.6"
Expand Down Expand Up @@ -479,6 +489,13 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-string-parser@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/helper-string-parser@npm:7.24.7"
checksum: 10/603d8d962bbe89907aa99a8f19a006759ab7b2464615f20a6a22e3e2e8375af37ddd0e5175c9e622e1c4b2d83607ffb41055a59d0ce34404502af30fde573a5c
languageName: node
linkType: hard

"@babel/helper-validator-identifier@npm:^7.16.7, @babel/helper-validator-identifier@npm:^7.22.20":
version: 7.22.20
resolution: "@babel/helper-validator-identifier@npm:7.22.20"
Expand All @@ -493,6 +510,13 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-validator-identifier@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/helper-validator-identifier@npm:7.24.7"
checksum: 10/86875063f57361471b531dbc2ea10bbf5406e12b06d249b03827d361db4cad2388c6f00936bcd9dc86479f7e2c69ea21412c2228d4b3672588b754b70a449d4b
languageName: node
linkType: hard

"@babel/helper-validator-option@npm:^7.23.5":
version: 7.23.5
resolution: "@babel/helper-validator-option@npm:7.23.5"
Expand Down Expand Up @@ -562,6 +586,18 @@ __metadata:
languageName: node
linkType: hard

"@babel/highlight@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/highlight@npm:7.24.7"
dependencies:
"@babel/helper-validator-identifier": "npm:^7.24.7"
chalk: "npm:^2.4.2"
js-tokens: "npm:^4.0.0"
picocolors: "npm:^1.0.0"
checksum: 10/69b73f38cdd4f881b09b939a711e76646da34f4834f4ce141d7a49a6bb1926eab1c594148970a8aa9360398dff800f63aade4e81fafdd7c8d8a8489ea93bfec1
languageName: node
linkType: hard

"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.5, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.8.3":
version: 7.23.9
resolution: "@babel/parser@npm:7.23.9"
Expand All @@ -580,6 +616,15 @@ __metadata:
languageName: node
linkType: hard

"@babel/parser@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/parser@npm:7.24.7"
bin:
parser: ./bin/babel-parser.js
checksum: 10/ef9ebce60e13db560ccc7af9235d460f6726bb7e23ae2d675098c1fc43d5249067be60d4118889dad33b1d4f85162cf66baf554719e1669f29bb20e71322568e
languageName: node
linkType: hard

"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.24.6":
version: 7.24.6
resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.24.6"
Expand Down Expand Up @@ -1641,6 +1686,17 @@ __metadata:
languageName: node
linkType: hard

"@babel/template@npm:^7.4.4":
version: 7.24.7
resolution: "@babel/template@npm:7.24.7"
dependencies:
"@babel/code-frame": "npm:^7.24.7"
"@babel/parser": "npm:^7.24.7"
"@babel/types": "npm:^7.24.7"
checksum: 10/5975d404ef51cf379515eb0f80b115981d0b9dff5539e53a47516644abb8c83d7559f5b083eb1d4977b20d8359ebb2f911ccd4f729143f8958fdc465f976d843
languageName: node
linkType: hard

"@babel/traverse@npm:7.23.2":
version: 7.23.2
resolution: "@babel/traverse@npm:7.23.2"
Expand Down Expand Up @@ -1727,6 +1783,17 @@ __metadata:
languageName: node
linkType: hard

"@babel/types@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/types@npm:7.24.7"
dependencies:
"@babel/helper-string-parser": "npm:^7.24.7"
"@babel/helper-validator-identifier": "npm:^7.24.7"
to-fast-properties: "npm:^2.0.0"
checksum: 10/ad3c8c0d6fb4acb0bb74bb5b4bb849b181bf6185677ef9c59c18856c81e43628d0858253cf232f0eca806f02e08eff85a1d3e636a3e94daea737597796b0b430
languageName: node
linkType: hard

"@bcoe/v8-coverage@npm:^0.2.3":
version: 0.2.3
resolution: "@bcoe/v8-coverage@npm:0.2.3"
Expand Down Expand Up @@ -4419,6 +4486,7 @@ __metadata:
"@typescript-eslint/parser": "npm:^7.0.0"
allure-js-commons: "workspace:*"
babel-plugin-add-module-exports: "npm:^1.0.4"
babel-plugin-transform-import-meta: "npm:^2.2.1"
chai: "npm:^4.3.8"
chai-like: "npm:^1.1.1"
chai-things: "npm:^0.2.0"
Expand Down Expand Up @@ -4981,6 +5049,18 @@ __metadata:
languageName: node
linkType: hard

"babel-plugin-transform-import-meta@npm:^2.2.1":
version: 2.2.1
resolution: "babel-plugin-transform-import-meta@npm:2.2.1"
dependencies:
"@babel/template": "npm:^7.4.4"
tslib: "npm:^2.4.0"
peerDependencies:
"@babel/core": ^7.10.0
checksum: 10/d6db38b379e3e42ac9b42c412bb1106b6899663385e0991530168e12c7516c701f70a1f96fdcc29581891d2eebf6f744a71b6fcf1cb2ec78782e0ceabec3d75b
languageName: node
linkType: hard

"babel-preset-current-node-syntax@npm:^1.0.0":
version: 1.0.1
resolution: "babel-preset-current-node-syntax@npm:1.0.1"
Expand Down Expand Up @@ -14349,6 +14429,13 @@ __metadata:
languageName: node
linkType: hard

"tslib@npm:^2.4.0":
version: 2.6.3
resolution: "tslib@npm:2.6.3"
checksum: 10/52109bb681f8133a2e58142f11a50e05476de4f075ca906d13b596ae5f7f12d30c482feb0bff167ae01cfc84c5803e575a307d47938999246f5a49d174fc558c
languageName: node
linkType: hard

"tunnel-agent@npm:^0.6.0":
version: 0.6.0
resolution: "tunnel-agent@npm:0.6.0"
Expand Down

0 comments on commit 0f269e3

Please sign in to comment.