jest-circus-allure-environment
Advanced tools
Comparing version 0.13.6 to 0.14.0
# Changelog | ||
# [0.14.0](https://github.com/ryparker/jest-circus-allure-environment/compare/v0.13.6...v0.14.0) (2021-01-02) | ||
### Features | ||
* **allure-node-environment.ts:** added `testPath` config option ([bf787c3](https://github.com/ryparker/jest-circus-allure-environment/commit/bf787c381f6d69c28949a8814a5b7a90e5ff9b6b)) | ||
## [0.13.6](https://github.com/ryparker/jest-circus-allure-environment/compare/v0.13.5...v0.13.6) (2020-12-30) | ||
@@ -4,0 +11,0 @@ |
import type { Circus, Config } from '@jest/types'; | ||
import AllureReporter from './allure-reporter'; | ||
import type { EnvironmentContext } from '@jest/environment'; | ||
@@ -8,4 +9,5 @@ import NodeEnvironment = require('jest-environment-node'); | ||
private readonly testFileName; | ||
private readonly docblockPragmas?; | ||
constructor(config: Config.ProjectConfig, context: EnvironmentContext); | ||
initializeTestPath(config: Config.ProjectConfig, context: EnvironmentContext): string; | ||
initializeAllureReporter(config: Config.ProjectConfig): AllureReporter; | ||
setup(): Promise<void>; | ||
@@ -12,0 +14,0 @@ teardown(): Promise<void>; |
@@ -9,17 +9,31 @@ "use strict"; | ||
constructor(config, context) { | ||
super(config); | ||
if (typeof config.testEnvironmentOptions.testPath === 'string') { | ||
this.testPath = config.testEnvironmentOptions.testPath; | ||
} | ||
this.testPath = this.initializeTestPath(config, context); | ||
this.testFileName = path_1.basename(this.testPath); | ||
this.reporter = this.initializeAllureReporter(config); | ||
this.global.allure = this.reporter.getImplementation(); | ||
} | ||
initializeTestPath(config, context) { | ||
var _a; | ||
let testPath = (_a = context.testPath) !== null && _a !== void 0 ? _a : ''; | ||
if (typeof config.testEnvironmentOptions.testPath === 'string') { | ||
testPath = testPath === null || testPath === void 0 ? void 0 : testPath.replace(config.testEnvironmentOptions.testPath, ''); | ||
} | ||
if (typeof config.testEnvironmentOptions.testPath !== 'string') { | ||
testPath = testPath === null || testPath === void 0 ? void 0 : testPath.replace(config.rootDir, ''); | ||
} | ||
if (testPath.startsWith('/')) { | ||
testPath = testPath.slice(1); | ||
} | ||
return testPath; | ||
} | ||
initializeAllureReporter(config) { | ||
var _a, _b, _c, _d, _e; | ||
super(config); | ||
const allureConfig = { | ||
resultsDir: (_a = config.testEnvironmentOptions.resultsDir) !== null && _a !== void 0 ? _a : 'allure-results' | ||
}; | ||
this.testPath = context.testPath ? context.testPath.replace(config.rootDir, '') : ''; | ||
if (this.testPath.includes('/tests/')) { | ||
this.testPath = this.testPath.split('tests/')[1]; | ||
} | ||
if (this.testPath.includes('/__tests__/')) { | ||
this.testPath = this.testPath.split('__tests__/')[1]; | ||
} | ||
this.testFileName = path_1.basename(this.testPath); | ||
this.docblockPragmas = context.docblockPragmas; | ||
this.reporter = new allure_reporter_1.default({ | ||
return new allure_reporter_1.default({ | ||
allureRuntime: new allure_js_commons_1.AllureRuntime(allureConfig), | ||
@@ -31,3 +45,2 @@ jiraUrl: (_b = config.testEnvironmentOptions) === null || _b === void 0 ? void 0 : _b.jiraUrl, | ||
}); | ||
this.global.allure = this.reporter.getImplementation(); | ||
} | ||
@@ -34,0 +47,0 @@ async setup() { |
@@ -214,3 +214,3 @@ "use strict"; | ||
if (!message) { | ||
message = 'Unformatted error. Expand for more details.'; | ||
message = 'Error. Expand for more details.'; | ||
trace = error; | ||
@@ -217,0 +217,0 @@ } |
{ | ||
"name": "jest-circus-allure-environment", | ||
"version": "0.13.6", | ||
"version": "0.14.0", | ||
"repository": "https://github.com/ryparker/jest-circus-allure-environment.git", | ||
@@ -76,3 +76,3 @@ "author": "Ryan Parker <ryan.parker3@outlook.com>", | ||
"@jest/types": "^26.6.2", | ||
"allure-js-commons": "2.0.0-beta.8", | ||
"allure-js-commons": "2.0.0-beta.9", | ||
"ansi_up": "^4.0.4", | ||
@@ -94,4 +94,4 @@ "crypto": "^1.0.1", | ||
"@types/jest": "^26.0.19", | ||
"@types/lodash": "^4.14.165", | ||
"@types/node": "^14.14.14", | ||
"@types/lodash": "^4.14.167", | ||
"@types/node": "^14.14.19", | ||
"commitizen": "^4.2.2", | ||
@@ -105,3 +105,3 @@ "conventional-changelog-conventionalcommits": "^4.5.0", | ||
"lint-staged": "^10.5.3", | ||
"semantic-release": "^17.3.0", | ||
"semantic-release": "^17.3.1", | ||
"typescript": "^4.1.3", | ||
@@ -108,0 +108,0 @@ "xo": "^0.36.1" |
@@ -125,2 +125,3 @@ # Jest Circus Allure Environment | ||
| categoryDefinitions | Array of custom categories you wish to see in the Allure report | `[]` | | ||
| testPath | Path to your test files. This path will be subtracted from the Allure report when organizing tests into suites. | `Jest.config.rootDir` | | ||
@@ -127,0 +128,0 @@ ## 📈 DocBlocks |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
80056
901
330
+ Addedallure-js-commons@2.0.0-beta.9(transitive)
- Removedallure-js-commons@2.0.0-beta.8(transitive)