|
2 | 2 | "use strict"; |
3 | 3 |
|
4 | 4 | module.exports = function(grunt) { |
5 | | - // https://wiki.saucelabs.com/display/DOCS/Platform+Configurator |
6 | | - // A lot of the browsers seem to time out with Saucelab's unit testing |
7 | | - // framework. Here are the browsers that work and get enough coverage for our |
8 | | - // needs. |
9 | | - var browsers = [ |
10 | | - {browserName: "chrome"}, |
11 | | - {browserName: "firefox", platform: "Linux"}, |
12 | | - {browserName: "internet explorer"} |
13 | | - ]; |
14 | | - |
15 | | - var tags = []; |
16 | | - if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != "false") { |
17 | | - tags.push("pr" + process.env.TRAVIS_PULL_REQUEST); |
18 | | - } else if (process.env.TRAVIS_BRANCH) { |
19 | | - tags.push(process.env.TRAVIS_BRANCH); |
20 | | - } |
21 | | - |
22 | 5 | var version = require("./package.json").version; |
23 | 6 |
|
24 | 7 | grunt.initConfig({ |
25 | | - connect: { |
26 | | - server: { |
27 | | - options: { |
28 | | - base: "", |
29 | | - port: 8080 |
30 | | - } |
31 | | - } |
32 | | - }, |
33 | | - 'saucelabs-qunit': { |
34 | | - all: { |
35 | | - options: { |
36 | | - urls: ["http://127.0.0.1:8080/test/index.html?hidepassed"], |
37 | | - build: process.env.TRAVIS_JOB_ID, |
38 | | - throttled: 4, |
39 | | - "max-duration": 1200, // seconds, IE6 is slow |
40 | | - browsers: browsers, |
41 | | - testname: "qunit tests", |
42 | | - tags: tags, |
43 | | - // Tests have statusCheckAttempts * pollInterval seconds to complete |
44 | | - pollInterval: 2000, |
45 | | - statusCheckAttempts: 240, |
46 | | - "max-duration": 1200, |
47 | | - browsers: browsers, |
48 | | - maxRetries: 2 |
49 | | - } |
50 | | - } |
51 | | - }, |
52 | 8 | jshint: { |
53 | 9 | // see https://github.com/gruntjs/grunt-contrib-jshint/issues/198 |
54 | 10 | // we can't override the options using the jshintrc path |
@@ -102,25 +58,10 @@ module.exports = function(grunt) { |
102 | 58 | } |
103 | 59 | }); |
104 | 60 |
|
105 | | - grunt.loadNpmTasks("grunt-contrib-connect"); |
106 | | - grunt.loadNpmTasks("grunt-saucelabs"); |
107 | 61 | grunt.loadNpmTasks('grunt-browserify'); |
108 | 62 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
109 | 63 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
110 | 64 |
|
111 | | - // A task to cause Grunt to sit and wait, keeping the test server running |
112 | | - grunt.registerTask("wait", function() { |
113 | | - this.async(); |
114 | | - }); |
115 | | - |
116 | | - grunt.registerTask("test-local", ["build", "connect", "wait"]); |
117 | | - grunt.registerTask("test-remote", ["build", "connect", "saucelabs-qunit"]); |
118 | | - |
119 | | - if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) { |
120 | | - grunt.registerTask("test", ["jshint", "test-remote"]); |
121 | | - } else { |
122 | | - grunt.registerTask("test", ["jshint", "test-local"]); |
123 | | - } |
124 | 65 | grunt.registerTask("build", ["browserify", "uglify"]); |
125 | 66 | grunt.registerTask("default", ["jshint", "build"]); |
126 | 67 | }; |
0 commit comments