ui5-test-runner 2.0.5 โ†’ 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/README.md CHANGED
@@ -20,7 +20,7 @@ A self-sufficient test runner for UI5 applications enabling parallel execution o
20
20
 
21
21
  ## ๐Ÿ’ฟ How to install
22
22
 
23
- * Works with [Node.js](https://nodejs.org/en/download/) >= 14
23
+ * Works with [Node.js](https://nodejs.org/en/download/) >= 16
24
24
  * Local installation
25
25
  * `npm install --save-dev ui5-test-runner`
26
26
  * Trigger either with `npx ui5-test-runner` or through an npm script invoking `ui5-test-runner`
@@ -47,7 +47,10 @@ A self-sufficient test runner for UI5 applications enabling parallel execution o
47
47
  ## โš–๏ธ License
48
48
  [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FArnaudBuchholz%2Fui5-test-runner.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FArnaudBuchholz%2Fui5-test-runner?ref=badge_large)
49
49
 
50
- ## โš ๏ธ Breaking change
50
+ ## โš ๏ธ Breaking changes
51
+
52
+ ### v3
53
+ * Dropping support of Node.js 14
51
54
 
52
55
  ### v2
53
56
 
package/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui5-test-runner",
3
- "version": "2.0.5",
3
+ "version": "3.0.0",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -12,7 +12,7 @@
12
12
  "ui5-test-runner": "./index.js"
13
13
  },
14
14
  "engines": {
15
- "node": ">=14.0.0"
15
+ "node": ">=16"
16
16
  },
17
17
  "scripts": {
18
18
  "lint": "standard --fix",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/ArnaudBuchholz/ui5-test-runner#readme",
47
47
  "dependencies": {
48
- "commander": "^10.0.0",
48
+ "commander": "^10.0.1",
49
49
  "mime": "^3.0.0",
50
50
  "punybind": "^1.2.1",
51
51
  "punyexpr": "^1.0.4",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "jest": "^29.5.0",
56
- "nock": "^13.3.0",
56
+ "nock": "^13.3.1",
57
57
  "nyc": "^15.1.0",
58
58
  "standard": "^17.0.0"
59
59
  },
package/src/job.js CHANGED
@@ -95,6 +95,7 @@ function getCommand (cwd) {
95
95
  .option('-r, --report-dir <path>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Directory to output test reports (relative to cwd)', 'report')
96
96
  .option('-pt, --page-timeout <timeout>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Limit the page execution time, fails the page if it takes longer than the timeout (0 means no timeout)', timeout, 0)
97
97
  .option('-f, --fail-fast [flag]', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Stop the execution after the first failing page', boolean, false)
98
+ .option('-fo, --fail-opa-fast [flag]', '[๐Ÿ’ป๐Ÿ”—] Stop the OPA page execution after the first failing test', boolean, false)
98
99
  .option('-k, --keep-alive [flag]', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Keep the server alive', boolean, false)
99
100
  .option('-l, --log-server [flag]', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Log inner server traces', boolean, false)
100
101
  .option('-p, --parallel <count>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Number of parallel tests executions', 2)
@@ -32,6 +32,24 @@ function get (job, urlWithHash, testId) {
32
32
  return { url, page, test }
33
33
  }
34
34
 
35
+ async function done (job, urlWithHash, report) {
36
+ const { url, page } = get(job, urlWithHash)
37
+ if (job.browserCapabilities.screenshot) {
38
+ try {
39
+ await screenshot(job, url, 'done')
40
+ } catch (error) {
41
+ getOutput(job).genericError(error, url)
42
+ }
43
+ }
44
+ if (report.__coverage__) {
45
+ collect(job, url, report.__coverage__)
46
+ delete report.__coverage__
47
+ }
48
+ page.end = new Date()
49
+ page.report = report
50
+ stop(job, url)
51
+ }
52
+
35
53
  module.exports = {
36
54
  get,
37
55
 
@@ -95,23 +113,23 @@ module.exports = {
95
113
  }
96
114
  test.end = new Date()
97
115
  test.report = report
116
+ if (job.failOpaFast && failed) {
117
+ // skip remaining tests
118
+ page.modules.forEach(module => {
119
+ module.tests.forEach(test => {
120
+ if (!test.report) {
121
+ test.skip = true
122
+ }
123
+ })
124
+ })
125
+ await done(job, urlWithHash, {
126
+ failed: page.failed,
127
+ passed: page.passed,
128
+ total: page.count,
129
+ runtime: 0
130
+ })
131
+ }
98
132
  },
99
133
 
100
- async done (job, urlWithHash, report) {
101
- const { url, page } = get(job, urlWithHash)
102
- if (job.browserCapabilities.screenshot) {
103
- try {
104
- await screenshot(job, url, 'done')
105
- } catch (error) {
106
- getOutput(job).genericError(error, url)
107
- }
108
- }
109
- if (report.__coverage__) {
110
- collect(job, url, report.__coverage__)
111
- delete report.__coverage__
112
- }
113
- page.end = new Date()
114
- page.report = report
115
- stop(job, url)
116
- }
134
+ done
117
135
  }
@@ -603,6 +603,44 @@ describe('src/qunit-hooks', () => {
603
603
  expect(stop).toHaveBeenCalledWith(job, url)
604
604
  expect(job.failed).toStrictEqual(true)
605
605
  })
606
+
607
+ describe.only('fail OPA fast behavior', () => {
608
+ beforeEach(async () => {
609
+ job.failOpaFast = true
610
+ await testDone(job, url, {
611
+ ...getTestDoneFor1a(),
612
+ passed: 0,
613
+ failed: 1,
614
+ total: 1
615
+ })
616
+ })
617
+
618
+ it('fails the test immediately', () => {
619
+ const { test } = get(job, url, '1a')
620
+ expect(test).toMatchObject({
621
+ report: {
622
+ passed: 0,
623
+ failed: 1,
624
+ total: 1
625
+ }
626
+ })
627
+ })
628
+
629
+ it('flags the remaining tests as skipped', () => {
630
+ const { page } = get(job, url)
631
+ page.modules.forEach(module => {
632
+ module.tests.forEach(test => {
633
+ if (test.testId !== '1a') {
634
+ expect(test.skip).toStrictEqual(true)
635
+ }
636
+ })
637
+ })
638
+ })
639
+
640
+ it('stops the page immediately', () => {
641
+ expect(stop).toHaveBeenCalledWith(job, url)
642
+ })
643
+ })
606
644
  })
607
645
 
608
646
  describe('done', () => {
package/src/tools.js CHANGED
@@ -1,17 +1,8 @@
1
1
  'use strict'
2
2
 
3
- const fsPromises = require('fs').promises
4
- const { mkdir, stat } = fsPromises
3
+ const { mkdir, rm, stat } = require('fs').promises
5
4
  const { createHash } = require('crypto')
6
5
 
7
- let rm
8
- /* istanbul ignore next */ // Hard to test both in the same run
9
- if (process.version > 'v14.14') {
10
- rm = fsPromises.rm
11
- } else {
12
- rm = fsPromises.rmdir
13
- }
14
-
15
6
  const recursive = { recursive: true }
16
7
 
17
8
  const stripUrlHash = url => url.split('#')[0]