Skip to content
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

render demo report for mocha tests #41

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pipeline {
}
post {
always {
allure results: [[path: '**/out/allure-results']]
deleteDir()
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/allure-mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build": "npm run lint && npm run compile",
"generate-report": "allure generate ./out/allure-results -o ./out/allure-report --clean",
"allure-report": "allure serve ./out/allure-results",
"test": "nyc mocha",
"test": "nyc node dist/test/runner",
"coverage": "codecov",
"lint": "eslint ./src ./test ./index.ts --ext .ts",
"lint-fix": "eslint ./src ./test ./index.ts --ext .ts --fix"
Expand All @@ -31,6 +31,7 @@
"dotenv": "^8.0.0",
"fs-jetpack": "^2.2.2",
"mocha": "^6.2.0",
"mocha-multi": "^1.1.1",
"mocha-typescript": "^1.1.17",
"nyc": "^14.0.0",
"prettier": "^1.17.0",
Expand Down
5 changes: 0 additions & 5 deletions packages/allure-mocha/test/mocha.opts

This file was deleted.

30 changes: 30 additions & 0 deletions packages/allure-mocha/test/runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// custom runner for mocha that allows to include a custom reporter
// which is not packed into an npm module
import Mocha from "mocha";
import glob from "glob";
import "source-map-support/register";

declare module "mocha" {
interface InterfaceContributions {
"mocha-typescript": never;
}
}

const mocha = new Mocha({
ui: "mocha-typescript",
timeout: 16000,
reporter: "mocha-multi",
reporterOptions: {
list: "-",
[require.resolve("../")]: {
stdout: "-",
options: {
resultsDir: "./out/allure-results"
}
}
}
});

glob.sync("dist/test/specs/**/*.js").forEach(file => mocha.addFile(file));

mocha.run(failures => process.exit(failures === 0 ? 0 : 1));