Fix phantom mocha tests

This commit is contained in:
Tankred Hase 2014-10-09 17:31:01 +02:00 committed by Felix Hammerl
parent 84d5bd8124
commit c6fb31fd49
4 changed files with 17 additions and 14 deletions

View File

@ -32,19 +32,13 @@ module.exports = function(grunt) {
}
},
mocha: {
mocha_phantomjs: {
all: {
options: {
urls: [
'http://localhost:<%= connect.test.options.port %>/test/unit/index.html',
'http://localhost:<%= connect.test.options.port %>/test/integration/index.html'
],
run: false,
reporter: 'Spec',
log: false,
// phanotmjs is soooo slow
timeout: 100000
]
}
}
},
@ -367,7 +361,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-csso');
grunt.loadNpmTasks('grunt-contrib-sass');
@ -376,6 +369,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-manifest');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
// Build tasks
grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']);
@ -385,7 +379,7 @@ module.exports = function(grunt) {
// Test/Dev tasks
grunt.registerTask('dev', ['connect:dev']);
grunt.registerTask('test', ['jshint', 'connect:test', 'mocha']);
grunt.registerTask('test', ['jshint', 'connect:test', 'mocha_phantomjs']);
grunt.registerTask('prod', ['connect:prod']);
//

View File

@ -63,8 +63,8 @@
"grunt-contrib-watch": "~0.5.3",
"grunt-csso": "~0.6.1",
"grunt-manifest": "^0.4.0",
"grunt-mocha": "~0.4.1",
"mocha": "~1.13.0",
"grunt-mocha-phantomjs": "^0.6.0",
"mocha": "^1.21.4",
"sinon": "~1.7.3",
"time-grunt": "^1.0.0"
}

View File

@ -23,7 +23,11 @@
<script src="index.js"></script>
<script>
mocha.run();
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
</script>
</body>
</html>

View File

@ -25,7 +25,12 @@
<script>
mocha.checkLeaks();
mocha.globals(['chrome']);
mocha.run();
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
</script>
</body>
</html>