cypress-plugin-last-failed 2.2.0 โ 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +11 -3
- package/README.md +6 -6
- package/cypress/config/cypress.config.js +2 -1
- package/cypress/e2e/tests.cy.js +5 -5
- package/cypress.config.js +2 -1
- package/package.json +4 -4
- package/src/index.js +4 -4
- package/assets/cypress-demo.gif +0 -0
- package/assets/cypress-last-failed.png +0 -0
- package/assets/failed-test-toggle.png +0 -0
|
@@ -22,9 +22,11 @@ jobs:
|
|
|
22
22
|
- name: Run failed tests from default directory ๐งช
|
|
23
23
|
if: always()
|
|
24
24
|
uses: cypress-io/github-action@v6
|
|
25
|
+
env:
|
|
26
|
+
DEBUG: cy-grep
|
|
25
27
|
with:
|
|
26
28
|
# environment variable used for CI/CD tests in this repo
|
|
27
|
-
command: npx cypress-plugin-last-failed run --
|
|
29
|
+
command: npx cypress-plugin-last-failed run --expose shouldPass=true
|
|
28
30
|
working-directory: ${{ github.workspace }}
|
|
29
31
|
exit-code-check:
|
|
30
32
|
runs-on: ubuntu-22.04
|
|
@@ -42,6 +44,8 @@ jobs:
|
|
|
42
44
|
id: run-failed
|
|
43
45
|
if: always()
|
|
44
46
|
continue-on-error: true
|
|
47
|
+
env:
|
|
48
|
+
DEBUG: cy-grep
|
|
45
49
|
run: |
|
|
46
50
|
set +e
|
|
47
51
|
npx cypress-plugin-last-failed run
|
|
@@ -60,7 +64,7 @@ jobs:
|
|
|
60
64
|
uses: cypress-io/github-action@v6
|
|
61
65
|
with:
|
|
62
66
|
# using cy-grep plugin burn test feature
|
|
63
|
-
command: npx cypress run --
|
|
67
|
+
command: npx cypress run --expose burn=10
|
|
64
68
|
working-directory: ${{ github.workspace }}
|
|
65
69
|
continue-on-error: true
|
|
66
70
|
- name: Output the file contents ๐
|
|
@@ -70,9 +74,11 @@ jobs:
|
|
|
70
74
|
- name: Run failed tests from default directory ๐งช
|
|
71
75
|
if: always()
|
|
72
76
|
uses: cypress-io/github-action@v6
|
|
77
|
+
env:
|
|
78
|
+
DEBUG: cy-grep
|
|
73
79
|
with:
|
|
74
80
|
# environment variable used for CI/CD tests in this repo
|
|
75
|
-
command: npx cypress-plugin-last-failed run --
|
|
81
|
+
command: npx cypress-plugin-last-failed run --expose shouldPass=true
|
|
76
82
|
working-directory: ${{ github.workspace }}
|
|
77
83
|
custom-dir-test-results:
|
|
78
84
|
runs-on: ubuntu-22.04
|
|
@@ -92,6 +98,8 @@ jobs:
|
|
|
92
98
|
- name: Run failed tests from custom directory ๐งช
|
|
93
99
|
if: always()
|
|
94
100
|
uses: cypress-io/github-action@v6
|
|
101
|
+
env:
|
|
102
|
+
DEBUG: cy-grep
|
|
95
103
|
with:
|
|
96
104
|
command: npm run custom-dir-last-failed
|
|
97
105
|
working-directory: ${{ github.workspace }}
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
A companion Cypress plugin for <code>cy-grep</code> that re-runs the last failed test(s).
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-

|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
<img width="2048" height="2346" alt="cypress-last-failed" src="https://github.com/user-attachments/assets/3c799547-06da-410e-82c9-47b52a1ec83c" />
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
@@ -62,7 +62,7 @@ const { collectFailingTests } = require('cypress-plugin-last-failed');
|
|
|
62
62
|
|
|
63
63
|
module.exports = defineConfig({
|
|
64
64
|
screenshotOnRunFailure: false,
|
|
65
|
-
|
|
65
|
+
expose: {
|
|
66
66
|
grepOmitFiltered: true,
|
|
67
67
|
grepFilterSpecs: true,
|
|
68
68
|
},
|
|
@@ -146,7 +146,7 @@ For convenience, you may desire to house the `npx` command within an npm script
|
|
|
146
146
|
|
|
147
147
|
Toggling the filter will run any previously failed tests on the particular spec file.
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
<img width="810" height="218" alt="failed-test-toggle" src="https://github.com/user-attachments/assets/f6294d1c-7a96-4fb3-a89c-29aba2cd1f46" />
|
|
150
150
|
|
|
151
151
|
### Recommended open mode env variables
|
|
152
152
|
|
|
@@ -154,7 +154,7 @@ Toggling the filter will run any previously failed tests on the particular spec
|
|
|
154
154
|
|
|
155
155
|
```json
|
|
156
156
|
{
|
|
157
|
-
"
|
|
157
|
+
"expose": {
|
|
158
158
|
"grepOmitFiltered": true,
|
|
159
159
|
"grepFilterSpecs": true
|
|
160
160
|
}
|
|
@@ -184,7 +184,7 @@ Now running or opening Cypress in interactive mode, **you will not see any tests
|
|
|
184
184
|
To run just those tests with the required tag `@skip` in interactive mode:
|
|
185
185
|
|
|
186
186
|
```bash
|
|
187
|
-
npx cypress open --
|
|
187
|
+
npx cypress open --expose grepTags=@skip
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
---
|
package/cypress/e2e/tests.cy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
describe('Should, run expected tests', () => {
|
|
2
2
|
it('should run', () => {
|
|
3
|
-
if (Cypress.
|
|
3
|
+
if (Cypress.expose('shouldPass')) {
|
|
4
4
|
expect(true).to.eq(true);
|
|
5
5
|
} else {
|
|
6
6
|
expect(true).to.eq(false);
|
|
@@ -13,7 +13,7 @@ describe('Should, run expected tests', () => {
|
|
|
13
13
|
|
|
14
14
|
describe('Inner suite, 1', () => {
|
|
15
15
|
it('needs to run', () => {
|
|
16
|
-
if (Cypress.
|
|
16
|
+
if (Cypress.expose('shouldPass')) {
|
|
17
17
|
expect(1).to.eq(1);
|
|
18
18
|
} else {
|
|
19
19
|
expect(1).to.eq(2);
|
|
@@ -21,7 +21,7 @@ describe('Should, run expected tests', () => {
|
|
|
21
21
|
});
|
|
22
22
|
describe('Inner suite, 2', () => {
|
|
23
23
|
it('needs to run', () => {
|
|
24
|
-
if (Cypress.
|
|
24
|
+
if (Cypress.expose('shouldPass')) {
|
|
25
25
|
expect(1).to.eq(1);
|
|
26
26
|
} else {
|
|
27
27
|
expect(1).to.eq(2);
|
|
@@ -31,7 +31,7 @@ describe('Should, run expected tests', () => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('will, be included in failed tests', () => {
|
|
34
|
-
if (Cypress.
|
|
34
|
+
if (Cypress.expose('shouldPass')) {
|
|
35
35
|
expect(10).to.eq(10);
|
|
36
36
|
} else {
|
|
37
37
|
expect(10).to.eq(2);
|
|
@@ -52,7 +52,7 @@ describe('Should, run expected tests', () => {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
it('non-suite test, 1', () => {
|
|
55
|
-
if (Cypress.
|
|
55
|
+
if (Cypress.expose('shouldPass')) {
|
|
56
56
|
expect(true).to.eq(true);
|
|
57
57
|
} else {
|
|
58
58
|
expect(true).to.eq(false);
|
package/cypress.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-plugin-last-failed",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Cypress plugin to rerun last failed tests in cypress run and open mode",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"last-failed": "npx cypress-plugin-last-failed run --e2e --browser electron",
|
|
9
9
|
"custom-dir-run": "LAST_FAILED_RESULTS_PATH=cypress/config npx cypress run",
|
|
10
|
-
"custom-dir-last-failed": "LAST_FAILED_RESULTS_PATH=cypress/config npx cypress-plugin-last-failed run --
|
|
10
|
+
"custom-dir-last-failed": "LAST_FAILED_RESULTS_PATH=cypress/config npx cypress-plugin-last-failed run --expose shouldPass=true"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
13
|
"cypress-plugin-last-failed": "runFailed.js"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"cypress-plugin"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@bahmutov/cy-grep": "^
|
|
22
|
-
"cypress": "^15.
|
|
21
|
+
"@bahmutov/cy-grep": "^3.0.1",
|
|
22
|
+
"cypress": "^15.12.0"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"registry": "https://registry.npmjs.org/"
|
package/src/index.js
CHANGED
|
@@ -54,8 +54,8 @@ const generateReports = (tests, spec, config) => {
|
|
|
54
54
|
const testCopy = [...test]; // Create a copy of the array to avoid mutation
|
|
55
55
|
let testTitle = testCopy.pop(); // Extract the test title
|
|
56
56
|
if (testTitle) {
|
|
57
|
-
// If --
|
|
58
|
-
testTitle = config.
|
|
57
|
+
// If --expose burn=X is set from cy-grep, remove the ": burning X of X"
|
|
58
|
+
testTitle = config.expose.burn
|
|
59
59
|
? testTitle.replace(/: burning .* of .*/, '')
|
|
60
60
|
: testTitle;
|
|
61
61
|
const report = {
|
|
@@ -66,8 +66,8 @@ const generateReports = (tests, spec, config) => {
|
|
|
66
66
|
reports.push(report);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
// If --
|
|
70
|
-
if (config.
|
|
69
|
+
// If --expose burn=X is set from cy-grep, remove the duplicate test objects
|
|
70
|
+
if (config.expose.burn) {
|
|
71
71
|
const seen = new Set();
|
|
72
72
|
const filteredReports = reports.filter((el) => {
|
|
73
73
|
const duplicate = seen.has(
|
package/assets/cypress-demo.gif
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|