mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Add grunt test task
This commit is contained in:
22
Gruntfile.js
22
Gruntfile.js
@@ -1,5 +1,11 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
mocha_phantomjs: {
|
||||
all: ['www/scripts/tests/index.html']
|
||||
},
|
||||
qunit: {
|
||||
all: ['www/include/js/tests/*.html']
|
||||
},
|
||||
clean: {
|
||||
"assets": ["assets", "www/assets"],
|
||||
},
|
||||
@@ -120,13 +126,13 @@ module.exports = function(grunt) {
|
||||
],
|
||||
"dest": "www/assets/jquery.ui/"
|
||||
},
|
||||
"js-fixture": {
|
||||
"js-fixtures": {
|
||||
"expand": true,
|
||||
"src": [
|
||||
"assets/js-fixtures/LICENSE",
|
||||
"assets/js-fixtures/fixtures.js"
|
||||
],
|
||||
"dest": "www/assets/js-fixture/",
|
||||
"dest": "www/assets/js-fixtures/",
|
||||
"flatten": true
|
||||
},
|
||||
"json3": {
|
||||
@@ -166,11 +172,15 @@ module.exports = function(grunt) {
|
||||
"qunit": {
|
||||
"expand": true,
|
||||
"src": [
|
||||
"assets/qunit/qunit/qunit.css",
|
||||
"assets/qunit/qunit/qunit.js"
|
||||
"qunit/qunit.css",
|
||||
"qunit/qunit.js",
|
||||
"addons/phantomjs/*"
|
||||
],
|
||||
"dest": "www/assets/qunit/",
|
||||
"flatten": true
|
||||
"cwd": "assets/qunit/",
|
||||
"rename": function(dest, src) {
|
||||
return dest + src.replace("qunit", "");
|
||||
},
|
||||
},
|
||||
"requirejs": {
|
||||
"expand": true,
|
||||
@@ -223,6 +233,8 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks("grunt-contrib");
|
||||
grunt.loadNpmTasks("grunt-bower-task");
|
||||
grunt.loadNpmTasks("grunt-bower-postinst");
|
||||
grunt.loadNpmTasks('grunt-mocha-phantomjs');
|
||||
|
||||
grunt.registerTask("build-assets", ["clean:assets", "bower", "bower_postinst", "copy", "less"]);
|
||||
grunt.registerTask('test', ["qunit", "mocha_phantomjs"]);
|
||||
};
|
||||
|
@@ -16,7 +16,7 @@
|
||||
"requirejs" : "~2.1",
|
||||
"backbone-amd": "~1.0",
|
||||
"underscore-amd": "~1.4",
|
||||
"mocha": "~1.9",
|
||||
"mocha": "latest",
|
||||
"chai" : "~1.6",
|
||||
"i18next": "~1.6",
|
||||
"js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip",
|
||||
|
@@ -6,10 +6,10 @@
|
||||
"mocha-phantomjs": ">=2.0 <3.0",
|
||||
"recess": ">=1.1.0 <1.1.7",
|
||||
"uglify-js": "latest",
|
||||
"phantomjs": "latest",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib": "latest",
|
||||
"grunt-bower-task": "latest",
|
||||
"grunt-bower-postinst": "latest"
|
||||
"grunt-bower-postinst": "latest",
|
||||
"grunt-mocha-phantomjs": "~0.3.0"
|
||||
}
|
||||
}
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
BASEDIR=$(dirname $0)
|
||||
ROOTDIR="$BASEDIR/../.."
|
||||
|
||||
PHANTOMJS_BIN=""
|
||||
MOCHA_PHANTOMJS_BIN=""
|
||||
|
||||
if type "$ROOTDIR/node_modules/.bin/phantomjs" > /dev/null; then
|
||||
PHANTOMJS_BIN="$ROOTDIR/node_modules/.bin/phantomjs"
|
||||
fi
|
||||
|
||||
if type "$ROOTDIR/node_modules/.bin/mocha-phantomjs" > /dev/null; then
|
||||
MOCHA_PHANTOMJS_BIN="$ROOTDIR/node_modules/.bin/mocha-phantomjs"
|
||||
fi
|
||||
|
||||
if [ -z "$PHANTOMJS_BIN" ]; then
|
||||
echo "phantomjs is required to run JS tests, see https://npmjs.org/package/phantomjs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MOCHA_PHANTOMJS_BIN" ]; then
|
||||
echo "mocha-phantomjs is required to run JS tests, see https://npmjs.org/package/mocha-phantomjs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# run qunit tests
|
||||
$PHANTOMJS_BIN "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Upload.js.html"
|
||||
$PHANTOMJS_BIN "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Edit.js.html"
|
||||
$PHANTOMJS_BIN "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Selection.js.html"
|
||||
|
||||
# run backbone tests
|
||||
$MOCHA_PHANTOMJS_BIN "$ROOTDIR/www/scripts/tests/index.html"
|
||||
|
||||
|
@@ -4,11 +4,14 @@
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<script src="../../../assets/jquery/jquery.js"></script>
|
||||
<script src="../../../assets/qunit/qunit/qunit.js"></script>
|
||||
<script src="../../../assets/qunit/qunit.js"></script>
|
||||
<script src="../jquery.Edit.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit/qunit.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit.css"/>
|
||||
<script> $(document).ready(function(){
|
||||
|
||||
// disable annoying log messages for tests
|
||||
console.log = function() {};
|
||||
console.error = function() {};
|
||||
|
||||
module("Add datas");
|
||||
|
||||
|
@@ -4,9 +4,9 @@
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<script src="../../../assets/jquery/jquery.js"></script>
|
||||
<script src="../../../assets/qunit/qunit/qunit.js"></script>
|
||||
<script src="../../../assets/qunit/qunit.js"></script>
|
||||
<script src="../jquery.Selection.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="../../../assets/qunit.css"/>
|
||||
<script> $(document).ready(function(){
|
||||
|
||||
|
||||
|
@@ -5,10 +5,10 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<script src="../../../assets/jquery/jquery.js"></script>
|
||||
<script src="../../jslibs/jquery-ui-1.10.3.js"></script>
|
||||
<script src="../../../assets/qunit/qunit/qunit.js"></script>
|
||||
<script src="../../../assets/qunit/qunit.js"></script>
|
||||
<script src="../../../assets/blueimp-load-image/load-image.js"></script>
|
||||
<script src="../../../skins/prod/jquery.Upload.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit/qunit.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit.css"/>
|
||||
<script> $(document).ready(function(){
|
||||
|
||||
var getUploadManager = function(){
|
||||
|
@@ -4,31 +4,18 @@ require.config({
|
||||
specs: "tests/specs",
|
||||
chai: "../assets/chai/chai",
|
||||
fixtures: "../assets/js-fixtures/fixtures",
|
||||
sinon: "../assets/sinon/lib/sinon",
|
||||
sinonSpy: "../assets/sinon/lib/sinon/spy",
|
||||
sinonMock: "../assets/sinon/lib/sinon/mock",
|
||||
sinonStub: "../assets/sinon/lib/sinon/stub",
|
||||
app: "apps/admin/fields/app",
|
||||
jquery: "../assets/jquery/jquery",
|
||||
jqueryui: "../include/jslibs/jquery-ui-1.10.3",
|
||||
jqueryui: "../assets/jquery.ui/jquery-ui",
|
||||
underscore: "../assets/underscore-amd/underscore",
|
||||
backbone: "../assets/backbone-amd/backbone",
|
||||
twig: "../assets/twig/twig",
|
||||
i18n: "../assets/i18next/release/i18next.amd-1.6.2.min",
|
||||
bootstrap: "../skins/build/bootstrap/js/bootstrap.min"
|
||||
i18n: "../assets/i18next/i18next.amd-1.6.3",
|
||||
bootstrap: "../assets/bootstrap/js/bootstrap.min"
|
||||
},
|
||||
shim: {
|
||||
bootstrap : ["jquery"],
|
||||
jqueryui: {
|
||||
deps: ["jquery"]
|
||||
},
|
||||
sinonSpy: {
|
||||
deps: ["sinon"],
|
||||
exports: "sinon"
|
||||
},
|
||||
sinonMock: {
|
||||
deps: ["sinon", "sinonSpy", "sinonStub"],
|
||||
exports: "sinon"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user