Skip to content

Commit 1f14c00

Browse files
committed
Adding a connect:tests task, to automatically open tests in the default browser.
Updating grunt-contrib-connect.
1 parent da0e4ac commit 1f14c00

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ You should see a green message in the console:
3939
You can also run the tests in the browser.
4040
Start a test server from the project root:
4141

42-
$ grunt connect:server:keepalive
42+
$ grunt connect:tests
4343

44-
Open the following URL in a browser:
45-
46-
$ open http://127.0.0.1:9999/test/index.html
44+
This will automatically open the tests at http://127.0.0.1:9998/test/index.html in the default browser.
4745

4846
_Note: we recommend cleaning all the browser cookies before running the tests, that can avoid false positive failures._
4947

Gruntfile.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,23 @@ module.exports = function (grunt) {
4949
}
5050
},
5151
connect: {
52-
server: {
52+
all: {
5353
options: {
5454
base: '.',
55-
directory: 'test',
55+
directory: 'test'
56+
}
57+
},
58+
saucelabs: {
59+
options: {
5660
port: 9999
5761
}
62+
},
63+
tests: {
64+
options: {
65+
open: 'http://127.0.0.1:9998/test/index.html',
66+
keepalive: true,
67+
port: 9998
68+
}
5869
}
5970
},
6071
'saucelabs-qunit': {
@@ -160,6 +171,6 @@ module.exports = function (grunt) {
160171
}
161172

162173
grunt.registerTask('default', ['jshint', 'qunit', 'uglify', 'compare_size']);
163-
grunt.registerTask('saucelabs', ['connect', 'saucelabs-qunit']);
174+
grunt.registerTask('saucelabs', ['connect:saucelabs', 'saucelabs-qunit']);
164175
grunt.registerTask('ci', ['jshint', 'qunit', 'saucelabs']);
165176
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"grunt-contrib-watch": "~0.3.0",
2626
"grunt-compare-size": "~0.4.0",
2727
"grunt-saucelabs": "~4.1.1",
28-
"grunt-contrib-connect": "~0.5.0",
28+
"grunt-contrib-connect": "~0.7.1",
2929
"gzip-js": "~0.3.0"
3030
},
3131
"volo": {

0 commit comments

Comments
 (0)