Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60767e9

Browse filesBrowse files
authored
feat(allure-codeceptjs): rework codeceptjs integration (via #1107)
1 parent 4fb78e9 commit 60767e9
Copy full SHA for 60767e9
Expand file treeCollapse file tree

30 files changed

+1142
-476
lines changed

‎.pnp.cjs

Copy file name to clipboardExpand all lines: .pnp.cjs
+44-6Lines changed: 44 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/allure-codeceptjs/package.json

Copy file name to clipboardExpand all lines: packages/allure-codeceptjs/package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"test": "vitest run"
4141
},
4242
"dependencies": {
43-
"allure-js-commons": "workspace:*"
43+
"allure-js-commons": "workspace:*",
44+
"allure-mocha": "workspace:*"
4445
},
4546
"devDependencies": {
4647
"@babel/cli": "^7.24.6",

‎packages/allure-codeceptjs/src/helpers.ts

Copy file name to clipboardExpand all lines: packages/allure-codeceptjs/src/helpers.ts
-28Lines changed: 0 additions & 28 deletions
This file was deleted.
+12-8Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1+
import { container } from "codeceptjs";
2+
import { attachment } from "allure-js-commons";
13
import type { ReporterConfig } from "allure-js-commons/sdk/reporter";
2-
import { setGlobalTestRuntime } from "allure-js-commons/sdk/runtime";
34
import { allureCodeceptJsLegacyApi } from "./legacy.js";
45
import { AllureCodeceptJsReporter } from "./reporter.js";
5-
import { AllureCodeceptJsTestRuntime } from "./runtime.js";
66

77
const allurePlugin = (config: ReporterConfig) => {
8-
const reporter = new AllureCodeceptJsReporter(config);
9-
const testRuntime = new AllureCodeceptJsTestRuntime(reporter);
8+
const mocha = container.mocha();
9+
mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, { ...config });
1010

11-
// @ts-ignore
12-
setGlobalTestRuntime(testRuntime);
13-
14-
return allureCodeceptJsLegacyApi;
11+
return {
12+
...allureCodeceptJsLegacyApi,
13+
// this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail
14+
addAttachment: (name: string, content: Buffer | string, contentType: string) => {
15+
// wrap it in attachmentStep. Since we use Mocha, Runtime API is sync, so no awaits is fine
16+
attachment(name, content, contentType);
17+
},
18+
};
1519
};
1620

1721
export default allurePlugin;

‎packages/allure-codeceptjs/src/model.ts

Copy file name to clipboardExpand all lines: packages/allure-codeceptjs/src/model.ts
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ export interface CodeceptStep {
2121
metaStep: CodeceptStep;
2222
toString: () => string;
2323
}
24-
25-
export type CodeceptHook = Mocha.Hook;
26-
27-
export type CodeceptTest = Mocha.Runnable;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.