From 8d262e3b1bf360bae7d5adb119e1f9f9701fd0a8 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 6 Jun 2021 22:15:00 +0100 Subject: [PATCH 1/3] Update js-reporters to 2.1.0 Important changes: * Mocha 8 and later are now supported. Previously, it's pending tests were incorrectly reported as undefined or failing. * `QUnit.todo()` is now supported. Previously, these intentional failures were reported by browserstack-runner as failing tests. With js-reported 2.1 the runEnd report counts them as `todo` instead of as `failed`. The API that browserstack-runner depends on has not changed since 1.1.0. . Specifically, browserstack-runner captures the following data in lib/_patch/reporter.js, and proccesses it in lib/server.js under the "_progress" and "_report" handlers: * The `testEnd` event, reading: - `name` string, - `suiteName` string, - `status` string, - `errors` array. * The `runEnd` event, reading: - `status` string, - `testCounts` object with ints `total`, `passed`, `failed`, `skipped`, - `runtime` int. These still exist the same way in the latest release: Fixes https://github.com/browserstack/browserstack-runner/issues/248. Ref https://github.com/browserstack/browserstack-runner/issues/247. --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index ecd9f4e..c73c967 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ "optional": true }, "js-reporters": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/js-reporters/-/js-reporters-1.1.0.tgz", - "integrity": "sha1-yDwA/g1Mn2f5RLTt1fOylXSXzWI=" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/js-reporters/-/js-reporters-2.1.0.tgz", + "integrity": "sha512-Q4GcEcPSb6ovhqp91claM3WPbSntQxbIn+3JiJgEXturys2ttWgs31VC60Yja+2unpNOH2A2qyjWFU2thCQ8sg==" }, "jsbn": { "version": "0.1.1", diff --git a/package.json b/package.json index 276f7f2..bbee5d3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "browserstack": "1.3.0", "chalk": "0.4.0", "circular-json": "0.3.1", - "js-reporters": "1.1.0", + "js-reporters": "2.1.0", "mime": "1.6.0", "resolve": "1.1.7", "send": "0.16.2", From dab609e86244ff895fe8fae0f669fb57b1593faa Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 6 Jun 2021 22:23:13 +0100 Subject: [PATCH 2/3] Fix reporting of QUnit todo tests The update to js-reporters 2.1.0 in the previous commit has fixed the most important problem, which is the build status reported by the `runEnd` event, handled via "_report" submission. However, the todo tests were still printed as errors in the output which is confusing. Before: ``` [Windows 8, Chrome 91.0] Error: "test.todo.each [0]" failed Expected: true Actual: false [Windows 8, Chrome 91.0] Passed: 332 tests, 321 passed, 0 failed, 7 skipped; ran for 1255ms ``` After: ``` [Windows 10, Firefox 88.0] Passed: 332 tests, 321 passed, 0 failed, 7 skipped; ran for 1910ms ``` Fixes https://github.com/browserstack/browserstack-runner/issues/247. --- lib/server.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/server.js b/lib/server.js index 6058ca1..828a92e 100644 --- a/lib/server.js +++ b/lib/server.js @@ -387,17 +387,27 @@ exports.Server = function Server(bsClient, workers, config, callback) { logger.trace('[%s] _progress', worker.id, CircularJSON.stringify(query)); - if (query && query.test && query.test.errors) { + if (query && query.test) { + // Include all tests in the report var browserReport = getBrowserReport(browserInfo); browserReport.tests.push(query.test || {}); - query.test.errors.forEach(function(error) { - logger.info('[%s] ' + chalk.red('Error:'), browserInfo, formatTraceback({ - error: error, - testName: query.test.name, - suiteName: query.test.suiteName - })); - }); + // Only print errors of failed tests + // (errors from todo tests are expected and will not be reported as + // "failed" to the "_report" handler either, so printing them here + // would create a confusing output with error printed but a success + // status at the end) + // https://github.com/browserstack/browserstack-runner/issues/247 + if (query.test.errors && query.test.status !== 'todo') { + query.test.errors.forEach(function(error) { + logger.info('[%s] ' + chalk.red('Error:'), browserInfo, formatTraceback({ + testName: query.test.name, + suiteName: query.test.suiteName, + status: query.test.status, + error: error + })); + }); + } } response.end(); }, From 019946e1261992140a36d13067ec6afd9a38f4df Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 6 Jun 2021 22:32:42 +0100 Subject: [PATCH 3/3] Tag 0.9.5-qunitjs.1 --- .travis.yml | 3 --- README.md | 7 +++++-- package-lock.json | 2 +- package.json | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45dbde0..cb0ca08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,6 @@ language: node_js node_js: - 'stable' -before_install: - - npm install -g grunt-cli jshint gulp - script: - npm run-script test-ci diff --git a/README.md b/README.md index 269106c..33c98b9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # BrowserStack Runner -[![Build Status](https://travis-ci.org/browserstack/browserstack-runner.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-runner) - A command line interface to run browser tests over BrowserStack. +## Hotfixes from [@qunitjs/browserstack-runner](https://github.com/qunitjs/browserstack-runner): + +1. Fix Mocha 8+ compat. [#248](https://github.com/browserstack/browserstack-runner/issues/248) +2. Fix QUnit.todo breakage. [#247](https://github.com/browserstack/browserstack-runner/issues/247) + ## Usage Install globally: diff --git a/package-lock.json b/package-lock.json index c73c967..ac13e26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "browserstack-runner", - "version": "0.9.5", + "version": "0.9.5-qunitjs.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bbee5d3..74d8c6a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "browserstack-runner", - "description": "A command line interface to run browser tests over BrowserStack", - "version": "0.9.5", + "name": "@qunitjs/browserstack-runner", + "description": "[Hotfix] run browser tests over BrowserStack", + "version": "0.9.5-qunitjs.1", "homepage": "https://github.com/browserstack/browserstack-runner", "repository": { "type": "git",