allure-jasmine
Advanced tools
Comparing version 2.15.1 to 3.0.0-beta.1
{ | ||
"name": "allure-jasmine", | ||
"version": "2.15.1", | ||
"version": "3.0.0-beta.1", | ||
"description": "Allure Jasmine integration", | ||
@@ -17,4 +17,11 @@ "homepage": "https://allurereport.org/", | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/cjs/index.js" | ||
} | ||
}, | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"types": "./dist/types/index.d.ts", | ||
"files": [ | ||
@@ -24,29 +31,42 @@ "dist" | ||
"scripts": { | ||
"clean": "rimraf ./dist ./out", | ||
"compile": "tsc", | ||
"lint": "eslint ./src ./index.ts --ext .ts", | ||
"lint:fix": "eslint ./src ./index.ts --ext .ts --fix", | ||
"runTest": "tsc -p tsconfig-tests.json && yarn run jasmine ./dist-tests/test/*.js", | ||
"runTestDebug": "node $NODE_DEBUG_OPTION ./node_modules/.bin/jasmine ./dist/test/*.js", | ||
"test": "rimraf ./out ; yarn run runTest" | ||
"clean": "rimraf ./dist", | ||
"compile": "run-s 'compile:*'", | ||
"compile:esm-babel": "babel --config-file ./babel.esm.json ./src --out-dir ./dist/esm --extensions '.ts' --source-maps", | ||
"compile:cjs-babel": "babel --config-file ./babel.cjs.json ./src --out-dir ./dist/cjs --extensions '.ts' --source-maps", | ||
"compile:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --declarationDir ./dist/types", | ||
"compile:fixup": "node ./scripts/fixup.mjs", | ||
"lint": "eslint ./src ./test --ext .ts", | ||
"lint:fix": "eslint ./src ./test --ext .ts --fix", | ||
"test": "vitest run" | ||
}, | ||
"dependencies": { | ||
"allure-js-commons": "2.15.1" | ||
"allure-js-commons": "3.0.0-beta.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.24.6", | ||
"@babel/core": "^7.24.6", | ||
"@babel/preset-env": "^7.24.6", | ||
"@babel/preset-typescript": "^7.24.6", | ||
"@types/babel__core": "^7", | ||
"@types/babel__preset-env": "^7", | ||
"@types/eslint": "^8", | ||
"@types/jasmine": "^3.3.12", | ||
"@types/node": "^20.6.3", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/parser": "^6.7.0", | ||
"eslint": "^8.49.0", | ||
"@typescript-eslint/eslint-plugin": "^7.0.0", | ||
"@typescript-eslint/parser": "^7.0.0", | ||
"babel-plugin-add-module-exports": "^1.0.4", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
"eslint-plugin-jsdoc": "^48.0.0", | ||
"eslint-plugin-n": "^17.0.0", | ||
"eslint-plugin-no-null": "^1.0.2", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"jasmine": "^3.4.0", | ||
"npm-run-all2": "^6.1.2", | ||
"rimraf": "^5.0.1", | ||
"typescript": "^5.2.2" | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2", | ||
"vitest": "^1.5.3" | ||
} | ||
} |
109
README.md
@@ -15,41 +15,108 @@ # allure-jasmine | ||
For usage example see `test/Setup.ts` | ||
## Installation | ||
## Usage with Jest (`jest@<27`) | ||
Use your favorite node package manager to install required packages: | ||
```bash | ||
npm add -D jest-jasmine2 allure-jasmine allure-js-commons @types/jasmine | ||
npm add -D allure-jasmine | ||
``` | ||
Create `allure-setup.ts` file: | ||
Create `spec/helpers/setup.ts` file with following content: | ||
```ts | ||
import { JasmineAllureReporter } from "allure-jasmine"; | ||
import { JasmineAllureInterface } from "allure-jasmine/dist/src/JasmineAllureReporter"; | ||
const AllureJasmineReporter = require("allure-jasmine"); | ||
const reporter = new JasmineAllureReporter({ resultsDir: "allure-results" }); | ||
const reporter = new AllureJasmineReporter(); | ||
jasmine.getEnv().addReporter(reporter); | ||
// @ts-expect-error | ||
global.allure = reporter.getInterface(); | ||
``` | ||
declare global { | ||
const allure: JasmineAllureInterface; | ||
} | ||
Check that the helper matches with `helper` field in your `spec/support/jasmine.json` file. | ||
## Use Allure runtime Api | ||
The plugin provides custom commands which allow to add additional info inside your tests: | ||
```javascript | ||
import { epic, attachment, parameter } from "allure-js-commons"; | ||
it("my test", async () => { | ||
await attachment("Attachment name", "Hello world!", "text/plain"); | ||
await epic("my_epic"); | ||
await parameter("parameter_name", "parameter_value", { | ||
mode: "hidden", | ||
excluded: false, | ||
}); | ||
}); | ||
``` | ||
Change your `jest.config.js` file: | ||
## Links usage | ||
```js | ||
module.exports = { | ||
preset: "ts-jest", | ||
+ testRunner: "jest-jasmine2", | ||
+ setupFilesAfterEnv: ["./allure-setup.ts"], | ||
}; | ||
import { link, issue, tms } from "allure-js-commons"; | ||
it("basic test", async () => { | ||
await link("https://allurereport.org", "link type", "Allure Report"); | ||
await issue("https://github.com/allure-framework/allure-js/issues/352", "Issue Name", ); | ||
await tms("https://github.com/allure-framework/allure-js/tasks/352", "Task Name"); | ||
}); | ||
``` | ||
You can find example setup and usage in this [repo](https://github.com/vovsemenv/allure-jest-example) | ||
You can also configure links formatters to make usage much more convenient. `%s` | ||
in `urlTemplate` parameter will be replaced by given value. | ||
[allure-jest]: https://github.com/allure-framework/allure-js/tree/master/packages/allure-jest | ||
```diff | ||
```ts | ||
const AllureJasmineReporter = require("allure-jasmine"); | ||
const reporter = new AllureJasmineReporter({ | ||
+ links: [ | ||
+ { | ||
+ type: "issue", | ||
+ urlTemplate: "https://example.org/issues/%s", | ||
+ nameTemplate: "Issue: %s", | ||
+ }, | ||
+ { | ||
+ type: "tms", | ||
+ urlTemplate: "https://example.org/tasks/%s" | ||
+ }, | ||
+ { | ||
+ type: "custom", | ||
+ urlTemplate: "https://example.org/custom/%s" | ||
+ }, | ||
+ ], | ||
}); | ||
jasmine.getEnv().addReporter(reporter); | ||
``` | ||
Then you can assign link using shorter notation: | ||
```js | ||
import { link, issue, tms } from "allure-js-commons"; | ||
it("basic test", async () => { | ||
await issue("351"); | ||
await issue("352", "Issue Name"); | ||
await tms("351"); | ||
await tms("352", "Task Name"); | ||
await link("custom", "352"); | ||
await link("custom", "352", "Link name"); | ||
}); | ||
``` | ||
## Steps usage | ||
The integration supports Allure steps, use them in following way: | ||
```js | ||
import { step } from "allure-js-commons"; | ||
it("my test", async () => { | ||
await step("foo", async () => { | ||
await step("bar", async () => { | ||
await step("baz", async () => {}); | ||
}); | ||
}); | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74858
19
546
122
25
1
1
+ Addedallure-js-commons@3.0.0-beta.1(transitive)
- Removedallure-js-commons@2.15.1(transitive)
- Removedansi-regex@4.1.1(transitive)
- Removedstrip-ansi@5.2.0(transitive)