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 6ce0961

Browse filesBrowse files
authored
new commons, ESM-compatible Cypress integration (via #905)
1 parent 54bfd37 commit 6ce0961
Copy full SHA for 6ce0961

File tree

Expand file treeCollapse file tree

119 files changed

+3709
-742
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

119 files changed

+3709
-742
lines changed

‎.eslintrc.js

Copy file name to clipboardExpand all lines: .eslintrc.js
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,6 @@ module.exports = {
160160
"arrow-body-style": "off",
161161
"arrow-parens": ["off", "always"],
162162
"brace-style": ["error", "1tbs"],
163-
"comma-dangle": [
164-
"error",
165-
{
166-
objects: "always-multiline",
167-
arrays: "always-multiline",
168-
functions: "always-multiline",
169-
imports: "always-multiline",
170-
},
171-
],
172163
complexity: "off",
173164
"constructor-super": "error",
174165
curly: "error",

‎.pnp.cjs

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

‎packages/allure-cucumberjs/test/specs/stepArguments.test.ts

Copy file name to clipboardExpand all lines: packages/allure-cucumberjs/test/specs/stepArguments.test.ts
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { expect } from "chai";
22
import { before, describe, it } from "mocha";
3-
import { TestResult } from "allure-js-commons/src/model";
43
import { LaunchSummary, runCucumberTests } from "../utils";
54

65
describe("step arguments", () => {

‎packages/allure-cypress/cypress.config.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress.config.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { readFileSync, rmSync, existsSync } = require("node:fs");
22
const { join, relative } = require("node:path");
33
const { globSync } = require("glob");
4-
const { allureCypress } = require("./dist/reporter");
4+
const { allureCypress } = require("allure-cypress/reporter");
55

66
module.exports = {
77
experimentalInteractiveRunEvents: true,

‎packages/allure-cypress/cypress/e2e/attachments.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/attachments.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { attachment } from "../../dist"
1+
import { attachment } from "allure-cypress"
22

33
describe("primitive data", () => {
44
describe("text", () => {

‎packages/allure-cypress/cypress/e2e/description.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/description.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { description, descriptionHtml } from "../../dist";
1+
import { description, descriptionHtml } from "allure-cypress";
22

33
after(() => {
44
cy.task("readLastTestResult").then((result) => {

‎packages/allure-cypress/cypress/e2e/displayName.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/displayName.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { displayName } from "../../dist";
1+
import { displayName } from "allure-cypress";
22

33
after(() => {
44
cy.task("readLastTestResult").then((result) => {

‎packages/allure-cypress/cypress/e2e/historyId.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/historyId.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { historyId } from "../../dist";
1+
import { historyId } from "allure-cypress";
22

33
after(() => {
44
cy.task("readLastTestResult").then((result) => {

‎packages/allure-cypress/cypress/e2e/labels.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/labels.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
subSuite,
1212
suite,
1313
tag,
14-
} from "../../dist";
14+
} from "allure-cypress";
1515

1616
describe("custom", () => {
1717
after(() => {

‎packages/allure-cypress/cypress/e2e/links.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/links.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { link, issue, tms } from "../../dist";
1+
import { link, issue, tms } from "allure-cypress";
22

33
describe("custom", () => {
44
after(() => {

‎packages/allure-cypress/cypress/e2e/parameters.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/parameters.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parameter } from "../../dist";
1+
import { parameter } from "allure-cypress";
22

33
after(() => {
44
cy.task("readLastTestResult").then((result) => {

‎packages/allure-cypress/cypress/e2e/steps.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/steps.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { step } from "../../dist";
1+
import { step } from "allure-cypress";
22

33
describe("single", () => {
44
after(() => {

‎packages/allure-cypress/cypress/e2e/testCaseId.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/testCaseId.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { testCaseId } from "../../dist";
1+
import { testCaseId } from "allure-cypress";
22

33
after(() => {
44
cy.task("readLastTestResult").then((result) => {

‎packages/allure-cypress/cypress/e2e/titleMetadata.cy.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/e2e/titleMetadata.cy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { label } from "../../dist";
1+
import { label } from "allure-cypress";
22

33
after(() => {
44
cy.task("readLastTestResult").then((result) => {

‎packages/allure-cypress/cypress/support/e2e.js

Copy file name to clipboardExpand all lines: packages/allure-cypress/cypress/support/e2e.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../../dist/commands";
1+
import "allure-cypress/commands";
22

33
Cypress.Commands.add("matches", { prevSubject: true }, (subject, object) => {
44
cy.wrap(subject).then((subject) => {

‎packages/allure-cypress/esbuild.ts

Copy file name to clipboardExpand all lines: packages/allure-cypress/esbuild.ts
-30Lines changed: 0 additions & 30 deletions
This file was deleted.

‎packages/allure-cypress/package.json

Copy file name to clipboardExpand all lines: packages/allure-cypress/package.json
+17-6Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@
2020
"author": "Qameta Software <allure@qameta.io> (https://qameta.io/)",
2121
"exports": {
2222
".": {
23-
"require": "./dist/index.js",
23+
"import": "./dist/index.mjs",
24+
"require": "./dist/index.cjs",
2425
"types": "./dist/index.d.ts"
2526
},
2627
"./commands": {
27-
"require": "./dist/commands.js",
28+
"import": "./dist/commands.mjs",
29+
"require": "./dist/commands.cjs",
2830
"types": "./dist/commands.d.ts"
2931
},
3032
"./reporter": {
31-
"require": "./dist/reporter.js",
33+
"import": "./dist/reporter.mjs",
34+
"require": "./dist/reporter.cjs",
3235
"types": "./dist/reporter.d.ts"
3336
}
3437
},
35-
"main": "./dist/index.js",
38+
"main": "./dist/index.cjs",
39+
"module": "./dist/index.mjs",
3640
"types": "./dist/index.d.ts",
3741
"directories": {
3842
"test": "test"
@@ -42,7 +46,9 @@
4246
],
4347
"scripts": {
4448
"clean": "rimraf ./dist ./out",
45-
"compile": "ts-node ./esbuild.ts && tsc --emitDeclarationOnly",
49+
"compile": "run-p 'compile:*'",
50+
"compile:lib": "rollup -c",
51+
"compile:types": "tsc --project ./tsconfig.json",
4652
"coverage": "codecov",
4753
"lint": "eslint ./src --ext .ts",
4854
"lint:fix": "eslint ./src --ext .ts --fix",
@@ -53,6 +59,9 @@
5359
},
5460
"devDependencies": {
5561
"@jest/globals": "^29.7.0",
62+
"@rollup/plugin-commonjs": "^25.0.7",
63+
"@rollup/plugin-node-resolve": "^15.2.3",
64+
"@rollup/plugin-typescript": "^11.1.6",
5665
"@types/eslint": "^8",
5766
"@types/glob": "^8.1.0",
5867
"@types/jest": "^29.5.12",
@@ -63,7 +72,6 @@
6372
"allure-jest": "workspace:*",
6473
"cypress": "^13.6.0",
6574
"enquirer": "^2.3.6",
66-
"esbuild": "^0.20.0",
6775
"eslint": "^8.49.0",
6876
"eslint-config-prettier": "^9.0.0",
6977
"eslint-plugin-cypress": "^2.15.1",
@@ -73,9 +81,12 @@
7381
"eslint-plugin-prefer-arrow": "^1.2.3",
7482
"glob": "^10.3.5",
7583
"jest": "^29.7.0",
84+
"npm-run-all": "^4.1.5",
7685
"rimraf": "^5.0.1",
86+
"rollup": "^4.13.0",
7787
"ts-jest": "^29.1.2",
7888
"ts-node": "^10.9.2",
89+
"tslib": "^2.6.2",
7990
"typescript": "^5.2.2"
8091
}
8192
}
+94Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import typescriptPlugin from "@rollup/plugin-typescript";
2+
import commonjsPlugin from "@rollup/plugin-commonjs";
3+
import resolvePlugin from "@rollup/plugin-node-resolve";
4+
import {glob} from "glob";
5+
import {join, relative} from "node:path";
6+
import {fileURLToPath} from "node:url";
7+
import {defineConfig} from "rollup";
8+
9+
const dirname = fileURLToPath(new URL(".", import.meta.url));
10+
11+
const createNodeEntry = (inputFile) => {
12+
const outputFileBase = inputFile.replace(/^src/, "dist");
13+
const external = ["node:fs", "allure-js-commons/new", "allure-js-commons/new/node"];
14+
15+
return [
16+
defineConfig({
17+
input: inputFile,
18+
output: {
19+
file: join(dirname, outputFileBase.replace(/\.ts$/, ".mjs")),
20+
format: "esm",
21+
exports: "named",
22+
sourcemap: true,
23+
},
24+
plugins: [
25+
typescriptPlugin({
26+
tsconfig: "./tsconfig.rollup.json",
27+
}),
28+
],
29+
external,
30+
}),
31+
defineConfig({
32+
input: inputFile,
33+
output: {
34+
file: join(dirname, outputFileBase.replace(/\.ts$/, ".cjs")),
35+
format: "cjs",
36+
exports: "named",
37+
sourcemap: true,
38+
},
39+
plugins: [
40+
typescriptPlugin({
41+
tsconfig: "./tsconfig.rollup.json",
42+
}),
43+
],
44+
external,
45+
}),
46+
];
47+
};
48+
const createBrowserEntry = (inputFile) => {
49+
const outputFileBase = inputFile.replace(/^src/, "dist");
50+
51+
return [
52+
defineConfig({
53+
input: inputFile,
54+
output: {
55+
file: join(dirname, outputFileBase.replace(/\.ts$/, ".mjs")),
56+
format: "esm",
57+
exports: "named",
58+
sourcemap: true,
59+
},
60+
plugins: [
61+
typescriptPlugin({
62+
tsconfig: "./tsconfig.rollup.json",
63+
}),
64+
resolvePlugin(),
65+
commonjsPlugin(),
66+
],
67+
}),
68+
defineConfig({
69+
input: inputFile,
70+
output: {
71+
file: join(dirname, outputFileBase.replace(/\.ts$/, ".cjs")),
72+
format: "cjs",
73+
exports: "named",
74+
sourcemap: true,
75+
},
76+
plugins: [
77+
typescriptPlugin({
78+
tsconfig: "./tsconfig.rollup.json",
79+
}),
80+
resolvePlugin(),
81+
commonjsPlugin(),
82+
],
83+
// external,
84+
}),
85+
];
86+
};
87+
88+
export default () => {
89+
return [
90+
createBrowserEntry("src/index.ts"),
91+
createBrowserEntry("src/commands.ts"),
92+
createNodeEntry("src/reporter.ts"),
93+
].flat();
94+
};

‎packages/allure-cypress/src/commands.ts

Copy file name to clipboardExpand all lines: packages/allure-cypress/src/commands.ts
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { MessageType, type ReportFinalMessage, Stage, Status } from "./model";
1+
import { Stage, Status } from "allure-js-commons/new";
2+
import { MessageType, type ReportFinalMessage, type ReporterMessage } from "./model";
23

34
const createFinalMesage = () =>
5+
// @ts-ignore
46
({
57
startMessage: undefined,
68
endMessage: undefined,
@@ -44,7 +46,7 @@ const getStepsMessagesPair = (reportMessage: ReportFinalMessage) =>
4446
acc[unfinishedStepIdx].push(message);
4547

4648
return acc;
47-
}, []);
49+
}, [] as ReporterMessage[][]);
4850

4951
// @ts-ignore
5052
Cypress.mocha

‎packages/allure-cypress/src/index.ts

Copy file name to clipboardExpand all lines: packages/allure-cypress/src/index.ts
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { LabelName, LinkType, MessageType, type ParameterOptions, Stage, Status } from "./model";
1+
import { LabelName, LinkType, ParameterOptions, Stage, Status } from "allure-js-commons/new";
2+
import { MessageType } from "./model";
23
import { pushReportMessage } from "./utils";
34

45
export type CypressWrappedAttachment = { type: string; data: unknown };
@@ -12,7 +13,7 @@ export const uint8ArrayToBase64 = (data: unknown) => {
1213
}
1314

1415
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
15-
return btoa(String.fromCharCode.apply(null, data));
16+
return btoa(String.fromCharCode.apply(null, data as number[]));
1617
};
1718

1819
export const normalizeAttachmentContentEncoding = (data: unknown, encoding: BufferEncoding): BufferEncoding => {

0 commit comments

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