From b6613922713542a970dc509e2089439a8c6e7784 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Mon, 9 Jan 2017 16:51:59 -0800 Subject: [PATCH] Permit overriding `name`, `build`, and `project` on a per-browser basis. Browserstack uses the `name` property in the browser configuration to uniquely name sessions within a specific build. If these sessions do not have a unique name, and are executed sequentially (or with a concurrency < total # of browsers), browserstack's UI will overwrite previous results with new ones. In cases where a karma test run is executed on multiple browsers, this isn't really desirable. While I was at it, I also incorporated changes from https://github.com/karma-runner/karma-browserstack-launcher/pull/71, and updated the README to also include documentation for that change. With this patch, `name`, `project`, and `build`, may all be overridden on a per browser basis. --- README.md | 3 +++ index.js | 6 +++--- package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7b55eca..44ebb39 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,9 @@ module.exports = function(config) { - `browser_version` version of the browser - `os` which platform ? - `os_version` version of the platform +- `build` the BS worker build name (optional, defaults to global) +- `name` the BS worker name (optional, defaults to global) +- `project` the BS worker project name (optional, defaults to global) ### BrowserStack reporter diff --git a/index.js b/index.js index 87f8742..f8a8167 100644 --- a/index.js +++ b/index.js @@ -181,9 +181,9 @@ var BrowserStackBrowser = function ( url: url + '?id=' + id, 'browserstack.tunnel': true, timeout: bsConfig.timeout || 300, - project: bsConfig.project, - name: bsConfig.name || 'Karma test', - build: bsConfig.build || + project: args.project || bsConfig.project, + name: args.name || bsConfig.name || 'Karma test', + build: args.build || bsConfig.build || process.env.BUILD_NUMBER || process.env.BUILD_TAG || process.env.CI_BUILD_NUMBER || diff --git a/package.json b/package.json index 362d30e..34352eb 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "eslint-config-standard": "^4.0.0", "eslint-plugin-standard": "^1.2.0", "grunt": "~0.4.5", - "grunt-auto-release": "~0.0.2", + "grunt-auto-release": "0.0.6", "grunt-bump": "~0.5.0", "grunt-conventional-changelog": "^4.1.0", "grunt-conventional-github-releaser": "^0.4.0",