Skip to content

Commit

Permalink
Integration with SauceLabs for cross-browser testing, and first pass …
Browse files Browse the repository at this point in the history
…at beautification support to ease whitespace merge issues.
  • Loading branch information
geekdave committed Sep 25, 2013
1 parent 91f34af commit 0176a56
Show file tree
Hide file tree
Showing 7 changed files with 5,370 additions and 5,079 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
@@ -1,3 +1,7 @@
language: node_js
node_js:
- "0.8"
- '0.8'
env:
global:
- secure: dtiDjGKC55oA3x84+/QZG1tJiDzTXQ0xW4kNnvk8P3hl4zpDVDdZZmKP1tlfp+6H9msp97ee/7oUlwOZE2V3zdXly3lg507DAf4ab4em6cxMtDyhgIUCyw8tJJVMvwIwO4NA7jJMfxgfp3DMABLSI35nQBAINL4vynV3H4vi1bU=
- secure: rX2bmEL2aTroTpZtBnwcdYj21xUlQUPWVY2BC7pDu2rWD75exRUwLPUpgY1cX6ADJGyjs+5+1voKBKsARsDX6yWG3KlVFS71OFWao7Tab9DMG8Yt6K29u0v/ETvTnHztlX92HXXODxh9jH2XZ0UBBq2JGMvXLUCcBLkLhyxbd4c=
173 changes: 133 additions & 40 deletions Gruntfile.js
@@ -1,7 +1,78 @@
module.exports = function ( grunt ) {
module.exports = function(grunt) {

var browsers = [
{
browserName: "firefox",
version: "22",
platform: "XP"
},
{
browserName: "firefox",
version: "21",
platform: "XP"
},
{
browserName: "chrome",
version: "29",
platform: "XP"
},
{
browserName: "chrome",
version: "28",
platform: "Mac 10.6"
},
{
browserName: 'internet explorer',
platform: 'WIN8',
version: '10'
},
{
browserName: 'internet explorer',
platform: 'VISTA',
version: '9'
},
{
browserName: 'internet explorer',
platform: 'XP',
version: '8'
},
{
browserName: 'safari',
platform: 'Mac 10.8',
version: '6'
},
{
browserName: 'safari',
platform: 'Mac 10.6',
version: '5'
},
{
browserName: 'iphone',
platform: 'Mac 10.8',
version: '6'
},
{
browserName: 'iphone',
platform: 'Mac 10.8',
version: '5.1'
},
{
browserName: 'ipad',
platform: 'Mac 10.8',
version: '6'
},
{
browserName: 'ipad',
platform: 'Mac 10.8',
version: '5.1'
}


];

var pkgConfig = grunt.file.readJSON('package.json');
pkgConfig.version = grunt.file.readJSON('version.json').version;
grunt.initConfig( {
grunt.initConfig({

pkg: pkgConfig,
uglify: {
Expand All @@ -18,55 +89,77 @@ module.exports = function ( grunt ) {
},

blanket_mocha: {
all: [ 'specs/index.html' ],
all: ['specs/index.html'],
options: {
threshold: 98,
log: true,
reporter: 'mocha-unfunk-reporter',
mocha: {}
}
},
version : {
defaults : {
src : [
version: {
defaults: {
src: [
'package.json', 'bower.json', '<%= pkg.name %>.js'
]
}
},
connect : {
options : {
port : 9001,
hostname : 'localhost',
base : '.'
},
test : {}
},
concurrent : {
options : {
logConcurrentOutput : true
},
test : [
'connect:test:keepalive', 'open:test'
]
},
open : {
test : {
path : 'http://localhost:9001/specs/index.html'
}
}
} );

grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-blanket-mocha' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-version' );
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-open');
"jsbeautifier": {
files: ['beautify.json', 'Gruntfile.js', 'backbone.geppetto.js', 'specs/*.js'],
options: {
config: "beautify.json"
}
},
connect: {
options: {
port: 9001,
hostname: 'localhost',
base: '.'
},
test: {}
},
concurrent: {
options: {
logConcurrentOutput: true
},
test: [
'connect:test:keepalive', 'open:test'
]
},
open: {
test: {
path: 'http://localhost:9001/specs/index.html'
}
},
'saucelabs-mocha': {
all: {
options: {
urls: ["http://localhost:9001/specs/index.html"],
build: process.env.TRAVIS_JOB_ID,
concurrency: 3,
browsers: browsers,
testname: "Backbone.Geppetto",
tags: ["master"]
}
}
}
});

grunt.registerTask( 'lint', ['jshint'] );
grunt.registerTask( 'coverage', ['blanket_mocha'] );
grunt.registerTask( 'travis', ['jshint', 'blanket_mocha'] );
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-blanket-mocha');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-version');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-saucelabs');

grunt.registerTask('beautify', ['jsbeautifier']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('coverage', ['blanket_mocha']);
grunt.registerTask('travis', ['jshint', 'blanket_mocha', "saucelabs-mocha"]);
grunt.registerTask("sauce", ["connect", "saucelabs-mocha"]);

grunt.registerTask( 'default', [ 'version', 'uglify', 'jshint', 'blanket_mocha'] );
grunt.registerTask('default', ['version', 'uglify', 'jshint', 'blanket_mocha']);
};
17 changes: 17 additions & 0 deletions beautify.json
@@ -0,0 +1,17 @@
{
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0
}
8 changes: 5 additions & 3 deletions package.json
Expand Up @@ -34,15 +34,17 @@
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1",
"grunt-cli": "~0.1.6",
"grunt-blanket-mocha": "~0.2.0",
"grunt-contrib-jshint": "~0.4.3",
"grunt-contrib-uglify": "~0.2.2",
"grunt-version": "~0.2.2",
"mocha-unfunk-reporter": "~0.2.0",
"grunt-contrib-connect": "~0.3.0",
"grunt-concurrent": "~0.3.0",
"grunt-open": "~0.2.2"
"grunt-concurrent": "~0.3.0",
"grunt-open": "~0.2.2",
"grunt-jsbeautifier": "~0.2.2",
"grunt-saucelabs": "~4.0.2"
},
"keywords": [
"backbone",
Expand Down
6 changes: 3 additions & 3 deletions specs/index.html
Expand Up @@ -16,10 +16,10 @@

<script data-main="test-main" src="../dependencies/require.js"></script>

<script type="text/javascript" src="lib/blanket.js"
data-cover-only="//../backbone.geppetto/"></script>
<!--<script type="text/javascript" src="lib/blanket.js"-->
<!--data-cover-only="//../backbone.geppetto/"></script>-->

<script type="text/javascript" src="../node_modules/grunt-blanket-mocha/support/mocha-blanket.js"></script>
<!--<script type="text/javascript" src="../node_modules/grunt-blanket-mocha/support/mocha-blanket.js"></script>-->

<script type="text/javascript" src="lib/sinon.js"></script>

Expand Down
18 changes: 9 additions & 9 deletions specs/mocha/mocha.css
Expand Up @@ -147,6 +147,7 @@ body {
-webkit-box-shadow: 0 1px 3px #eee;
-moz-border-radius: 3px;
-moz-box-shadow: 0 1px 3px #eee;
border-radius: 3px;
}

#mocha .test h2 {
Expand Down Expand Up @@ -187,22 +188,21 @@ body {
display: none;
}

#mocha-report.pending .test.pass,
#mocha-report.pending .test.fail {
display: none;
}
#mocha-report.pending .test.pass.pending {
display: block;
}

#mocha-error {
color: #c00;
font-size: 1.5em;
font-weight: 100;
letter-spacing: 1px;
}

#mocha-report.pending .test.pass
#mocha-report.pending .test.fail{
display: none;
}
#mocha-report.pending .test.pass.pending {
display: block;
}


#mocha-stats {
position: fixed;
top: 15px;
Expand Down

0 comments on commit 0176a56

Please sign in to comment.