-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(allure-codeceptjs): rework codeceptjs integration (via #1107)
- Loading branch information
Showing
30 changed files
with
1,142 additions
and
476 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import { container } from "codeceptjs"; | ||
import { attachment } from "allure-js-commons"; | ||
import type { ReporterConfig } from "allure-js-commons/sdk/reporter"; | ||
import { setGlobalTestRuntime } from "allure-js-commons/sdk/runtime"; | ||
import { allureCodeceptJsLegacyApi } from "./legacy.js"; | ||
import { AllureCodeceptJsReporter } from "./reporter.js"; | ||
import { AllureCodeceptJsTestRuntime } from "./runtime.js"; | ||
|
||
const allurePlugin = (config: ReporterConfig) => { | ||
const reporter = new AllureCodeceptJsReporter(config); | ||
const testRuntime = new AllureCodeceptJsTestRuntime(reporter); | ||
const mocha = container.mocha(); | ||
mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, { ...config }); | ||
|
||
// @ts-ignore | ||
setGlobalTestRuntime(testRuntime); | ||
|
||
return allureCodeceptJsLegacyApi; | ||
return { | ||
...allureCodeceptJsLegacyApi, | ||
// this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail | ||
addAttachment: (name: string, content: Buffer | string, contentType: string) => { | ||
// wrap it in attachmentStep. Since we use Mocha, Runtime API is sync, so no awaits is fine | ||
attachment(name, content, contentType); | ||
}, | ||
}; | ||
}; | ||
|
||
export default allurePlugin; |
This file contains 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
Oops, something went wrong.