Skip to content

Commit b52f564

Browse files
committed
Set up initial, minimal BrowserStack configuration
1 parent 3fcefa5 commit b52f564

File tree

6 files changed

+27
-115
lines changed

6 files changed

+27
-115
lines changed

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
addons:
2+
browserstack:
3+
username: "klaushartl1"
4+
access_key:
5+
secure: "LpBr6ShBiV3Ai8YeHi44tRNHsqg1nj5rqCSZlHRG4dq59S2lmXGQjaOUVGBT5D1Omo0FKCRrky3hREt0hioWCo6hhEnRDBkNdHe4oD/4UmCyNr7n285sJaeJCMgzGcG/+aUDziiM+YlfbxN8Rp+TZ5AGnq83bxJkmQL26GKBdtA="
6+
17
language: node_js
8+
29
node_js:
310
- '6'
4-
# Only use grunt-ci for commits pushed to this repo. Fall back to regular test
5-
# for pull requests (as secure variables won't be exposed there).
11+
612
script:
713
- ./travis.sh
8-
env:
9-
# Encrypted SAUCE_USERNAME and SAUCE_ACCESS_KEY used by travis
10-
global:
11-
- secure: IkMOa/8r4sWyzUMxecsfqoPzZyIqVAMwPkQ6/HxXPbT8X7UnvqAdaicAMeHEKtOnOac+rx6pGB9HQvC8P/ZzkEBtsKLP4nEh9vsAInZvb3pXg+qbIgIK6/19X0kU4UkpDqVdWmBuFTamJvMDMstUTgEaM3869bB5vGp9taBgfVo=
12-
- secure: DKrQplF0CBiBh+cbQ8D7EKebCeklUWEELblIJdU4475Occ4G9b8ZFYO9HFwl1B8F/XapB7CsMyxbJCWor030FySeqn8bhJs9NoAVoYGg+MtWniv1EOHuZLWuOGfgQDv7qj5U0Af9Y655MmUpXSN2aDlCmQweWnYdpFTM9Dfsdd8=

Gruntfile.js

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ module.exports = function (grunt) {
115115
}
116116
}
117117
},
118-
'build-sauce': {
119-
options: {
120-
port: 9999,
121-
base: ['.', 'test']
122-
}
123-
},
124118
tests: {
125119
options: {
126120
port: 10000,
@@ -135,73 +129,8 @@ module.exports = function (grunt) {
135129
}
136130
}
137131
},
138-
'saucelabs-qunit': {
139-
all: {
140-
options: {
141-
urls: ['http://127.0.0.1:9999'],
142-
testname: 'Sauce Test for js-cookie',
143-
build: process.env.TRAVIS_JOB_ID,
144-
statusCheckAttempts: -1,
145-
throttled: 3,
146-
browsers: [
147-
{
148-
browserName: 'safari',
149-
platform: 'OS X 10.11',
150-
version: '10.0'
151-
},
152-
{
153-
browserName: 'safari',
154-
platform: 'OS X 10.12',
155-
version: '10.1'
156-
},
157-
{
158-
browserName: 'safari',
159-
platform: 'OS X 10.13',
160-
version: '11.0'
161-
},
162-
{
163-
browserName: 'firefox',
164-
platform: 'OS X 10.11',
165-
version: '56.0'
166-
},
167-
{
168-
browserName: 'chrome',
169-
platform: 'OS X 10.10',
170-
version: '61.0'
171-
},
172-
{
173-
browserName: 'internet explorer',
174-
platform: 'Windows 7',
175-
version: '11.0'
176-
},
177-
{
178-
browserName: 'internet explorer',
179-
platform: 'Windows 7',
180-
version: '10.0'
181-
},
182-
{
183-
browserName: 'internet explorer',
184-
platform: 'Windows 7',
185-
version: '9.0'
186-
},
187-
{
188-
browserName: 'internet explorer',
189-
platform: 'Windows 7',
190-
version: '8.0'
191-
},
192-
{
193-
browserName: 'firefox',
194-
platform: 'Linux',
195-
version: '45.0'
196-
},
197-
{
198-
browserName: 'chrome',
199-
platform: 'Linux',
200-
version: '48.0'
201-
}
202-
]
203-
}
204-
}
132+
exec: {
133+
'browserstack-runner': 'node_modules/.bin/browserstack-runner'
205134
}
206135
});
207136

@@ -212,11 +141,10 @@ module.exports = function (grunt) {
212141
}
213142
}
214143

215-
grunt.registerTask('saucelabs', ['connect:build-sauce', 'saucelabs-qunit']);
216144
grunt.registerTask('test', ['uglify', 'jshint', 'jscs', 'connect:build-qunit', 'qunit', 'nodeunit']);
217145

218146
grunt.registerTask('dev', ['test', 'compare_size']);
219-
grunt.registerTask('ci', ['test', 'saucelabs']);
147+
grunt.registerTask('ci', ['test', 'exec:browserstack-runner']);
220148

221149
grunt.registerTask('default', 'dev');
222150
};

browserstack.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"test_framework": "qunit",
3+
"test_path": [
4+
"test/index.html"
5+
],
6+
"exit_with_fail": true,
7+
"browsers": [
8+
"chrome_latest"
9+
]
10+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"author": "Klaus Hartl",
3333
"license": "MIT",
3434
"devDependencies": {
35+
"browserstack-runner": "0.7.0",
3536
"grunt": "1.0.2",
3637
"grunt-compare-size": "0.4.2",
3738
"grunt-contrib-connect": "1.0.2",
@@ -40,8 +41,8 @@
4041
"grunt-contrib-qunit": "2.0.0",
4142
"grunt-contrib-uglify": "2.3.0",
4243
"grunt-contrib-watch": "1.0.0",
44+
"grunt-exec": "3.0.0",
4345
"grunt-jscs": "3.0.1",
44-
"grunt-saucelabs": "9.0.0",
4546
"gzip-js": "0.3.2",
4647
"qunitjs": "1.23.1",
4748
"requirejs": "2.3.5"

test/utils.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
1-
// https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit
21
(function () {
32
'use strict';
43

5-
var log = [];
6-
7-
QUnit.done(function (test_results) {
8-
var tests = [];
9-
for (var i = 0, len = log.length; i < len; i++) {
10-
var details = log[i];
11-
tests.push({
12-
name: details.name,
13-
result: details.result,
14-
expected: details.expected,
15-
actual: details.actual,
16-
source: details.source
17-
});
18-
}
19-
test_results.tests = tests;
20-
// Required for exposing test results to the Sauce Labs API.
21-
// Can be removed when the following issue is fixed:
22-
// https://github.com/axemclion/grunt-saucelabs/issues/84
23-
window.global_test_results = test_results;
24-
});
25-
26-
QUnit.testStart(function (testDetails) {
27-
QUnit.log(function (details) {
28-
if (!details.result) {
29-
details.name = testDetails.name;
30-
log.push(details);
31-
}
32-
});
33-
});
34-
354
window.lifecycle = {
365
afterEach: function () {
376
// Remove the cookies created using js-cookie default attributes

travis.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
2-
if [ -z "$SAUCE_ACCESS_KEY" ]; then
2+
3+
# Only use `grunt ci` for commits pushed to this repo. Fall back to regular test
4+
# for pull requests (as secure variables won't be exposed there).
5+
if [ -z "$BROWSERSTACK_LOCAL_IDENTIFIER" ]; then
36
npm test
47
else
58
grunt ci --verbose

0 commit comments

Comments
 (0)