cypress-plugin-last-failed 2.0.5 โ†’ 2.0.7

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.
@@ -26,6 +26,31 @@ jobs:
26
26
  # environment variable used for CI/CD tests in this repo
27
27
  command: npx cypress-plugin-last-failed run --env shouldPass=true
28
28
  working-directory: ${{ github.workspace }}
29
+ exit-code-check:
30
+ runs-on: ubuntu-22.04
31
+ steps:
32
+ - name: Checkout ๐Ÿ“ฆ
33
+ uses: actions/checkout@v4
34
+ - name: Cypress run ๐Ÿ‘Ÿ
35
+ uses: cypress-io/github-action@v6
36
+ continue-on-error: true
37
+ - name: Output the file contents ๐Ÿ“
38
+ if: always()
39
+ run: |
40
+ cat ./test-results/last-run.json
41
+ - name: Run failed tests from default directory ๐Ÿงช
42
+ id: run-failed
43
+ if: always()
44
+ continue-on-error: true
45
+ run: |
46
+ set +e
47
+ npx cypress-plugin-last-failed run
48
+ exitcode="$?"
49
+ echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
50
+ - name: Output the runFailed node script exit code ๐Ÿ“
51
+ if: always()
52
+ run: |
53
+ echo ${{ steps.run-failed.outputs.exitcode }}
29
54
  burn-test-results:
30
55
  runs-on: ubuntu-22.04
31
56
  steps:
@@ -1,4 +1,4 @@
1
- describe('Should run expected tests', () => {
1
+ describe('Should, run expected tests', () => {
2
2
  it('should run', () => {
3
3
  if (Cypress.env('shouldPass')) {
4
4
  expect(true).to.eq(true);
@@ -19,7 +19,7 @@ describe('Should run expected tests', () => {
19
19
  }
20
20
  });
21
21
 
22
- it('will be included in failed tests', () => {
22
+ it('will, be included in failed tests', () => {
23
23
  if (Cypress.env('shouldPass')) {
24
24
  expect(10).to.eq(10);
25
25
  } else {
@@ -39,3 +39,11 @@ describe('Should run expected tests', () => {
39
39
  expect(10).to.eq(10);
40
40
  });
41
41
  });
42
+
43
+ it('non-suite test, 1', () => {
44
+ if (Cypress.env('shouldPass')) {
45
+ expect(true).to.eq(true);
46
+ } else {
47
+ expect(true).to.eq(false);
48
+ }
49
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-last-failed",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
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",
package/runFailed.js CHANGED
@@ -29,16 +29,17 @@ Try running tests again with cypress run`;
29
29
  test,
30
30
  }));
31
31
  // Combine parent suite and test together
32
+ // If parent title is empty do not add space before test title
32
33
  const resultSet = new Set(
33
34
  Object.values(parentAndTest).flatMap(
34
- (parent) => parent.parent + ',' + parent.test + ';'
35
+ (parent) =>
36
+ (parent.parent !== '' ? parent.parent + ' ' : parent.parent) +
37
+ parent.test
35
38
  )
36
39
  );
40
+
37
41
  // Format string for use in grep functionality
38
- const stringedTests = Array.from(resultSet)
39
- .toString()
40
- .replaceAll(',', ' ')
41
- .slice(0, -1);
42
+ const stringedTests = Array.from(resultSet).join('; ').toString();
42
43
 
43
44
  if (stringedTests.length > 0) {
44
45
  // Allow for additional cli arguments to be passed to the run command
@@ -51,7 +52,15 @@ Try running tests again with cypress run`;
51
52
  process.env.CYPRESS_grepFilterSpecs = true;
52
53
  process.env.CYPRESS_grepOmitFiltered = true;
53
54
 
54
- await cypress.run(runOptions);
55
+ await cypress
56
+ .run(runOptions)
57
+ .then((results) => {
58
+ process.exit(results.totalFailed);
59
+ })
60
+ .catch((err) => {
61
+ console.error(err);
62
+ process.exit(1);
63
+ });
55
64
  } else {
56
65
  console.log(noFailedTestsMessage);
57
66
  }