fix tests

This commit is contained in:
Florian BLOUET
2015-12-02 12:52:36 +01:00
parent b2108c5cf6
commit 60639d0e96
12 changed files with 75 additions and 62 deletions

View File

@@ -50,6 +50,7 @@ before_script:
- "./bin/developer phraseanet:regenerate-sqlite" - "./bin/developer phraseanet:regenerate-sqlite"
- "./bin/developer phraseanet:generate-js-fixtures" - "./bin/developer phraseanet:generate-js-fixtures"
script: script:
- "./node_modules/.bin/gulp test"
- | - |
if [ "$TEST_SUITE" = "1" ]; then if [ "$TEST_SUITE" = "1" ]; then
"./bin/phpunit" "tests/classes/"; "./bin/phpunit" "tests/classes/";

View File

@@ -42,5 +42,6 @@ database:
test: test:
override: override:
- case $CIRCLE_NODE_INDEX in 0) php -d memory_limit=-1 bin/phpunit --exclude-group legacy ;; 1) ./node_modules/.bin/gulp test ;; 2) php -d memory_limit=-1 bin/phpunit --group legacy --exclude-group web ;; 3) php -d memory_limit=-1 bin/phpunit --group web ;; esac:
- case $CIRCLE_NODE_INDEX in 0) php -d memory_limit=-1 bin/phpunit --exclude-group legacy ;; 1) php -d memory_limit=-1 bin/phpunit --group legacy --exclude-group web ;; 2) php -d memory_limit=-1 bin/phpunit --group web ;; esac: - case $CIRCLE_NODE_INDEX in 0) php -d memory_limit=-1 bin/phpunit --exclude-group legacy ;; 1) php -d memory_limit=-1 bin/phpunit --group legacy --exclude-group web ;; 2) php -d memory_limit=-1 bin/phpunit --group web ;; esac:
parallel: true parallel: true

View File

@@ -1,6 +1,7 @@
var gulp = require('gulp'); var gulp = require('gulp');
var config = require('../config.js'); var config = require('../config.js');
var utils = require('../utils.js'); var utils = require('../utils.js');
var qunit = require('gulp-qunit');
var debugMode = false; var debugMode = false;
@@ -107,6 +108,12 @@ gulp.task('build-prod-js', function(){
]; ];
return utils.buildJsGroup(prodGroup, 'prod', 'prod/js', debugMode); return utils.buildJsGroup(prodGroup, 'prod', 'prod/js', debugMode);
}); });
gulp.task('test-prod', function () {
return gulp.src(config.paths.src + 'prod/js/tests/*.html')
.pipe(qunit());
});
gulp.task('watch-prod-js', function() { gulp.task('watch-prod-js', function() {
debugMode = true; debugMode = true;
return gulp.watch(config.paths.src + 'prod/**/*.js', ['build-prod-js']); return gulp.watch(config.paths.src + 'prod/**/*.js', ['build-prod-js']);

View File

@@ -4,14 +4,8 @@ var mochaPhantomjs = require('gulp-mocha-phantomjs');
var config = require('./config.js'); var config = require('./config.js');
var paths = {
vendors: 'tmp-assets/',
dist: 'www/assets/'
};
gulp.task('mocha_phantomjs', function () { gulp.task('mocha_phantomjs', function () {
return gulp.src('www/scripts/tests/*.html') return gulp.src('www/scripts/tests/!*.html')
.pipe(mochaPhantomjs({ .pipe(mochaPhantomjs({
'reporter': 'dot', 'reporter': 'dot',
'setting': [ 'setting': [
@@ -20,11 +14,11 @@ gulp.task('mocha_phantomjs', function () {
})); }));
}); });
gulp.task('qunit', function () { gulp.task('test-components', function () {
return gulp.src('www/include/js/tests/*.html') return gulp.start('test-prod');
.pipe(qunit());
}); });
// JS fixtures should be present (./bin/developer phraseanet:generate-js-fixtures)
// js fixtures should be present (./bin/developer phraseanet:generate-js-fixtures) // Note: fixture are loaded into scripts/tests/fixtures directory using
gulp.task('test', ['qunit','mocha_phantomjs']); // bin/developer phraseanet:regenerate-js-fixtures
gulp.task('test', ['test-components']);

View File

@@ -3,10 +3,10 @@
<head> <head>
<title></title> <title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../../../assets/jquery/jquery.js"></script> <script src="../../../../../www/assets/vendors/jquery/jquery.js"></script>
<script src="../../../assets/qunit/qunit.js"></script> <script src="../../../../../www/bower_components/qunit/qunit/qunit.js"></script>
<script src="../jquery.Edit.js"></script> <script src="../jquery.Edit.js"></script>
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit.css"/> <link type="text/css" rel="stylesheet" href="../../../../../www/bower_components/qunit/qunit/qunit.css"/>
<script> $(document).ready(function(){ <script> $(document).ready(function(){
// disable log messages in tests // disable log messages in tests

View File

@@ -3,10 +3,10 @@
<head> <head>
<title></title> <title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../../../assets/jquery/jquery.js"></script> <script src="../../../../../www/assets/vendors/jquery/jquery.js"></script>
<script src="../../../assets/qunit/qunit.js"></script> <script src="../../../../../www/bower_components/qunit/qunit/qunit.js"></script>
<script src="../jquery.Selection.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="../../../../../www/bower_components/qunit/qunit/qunit.css"/>
<script> $(document).ready(function(){ <script> $(document).ready(function(){

View File

@@ -3,12 +3,12 @@
<head> <head>
<title></title> <title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../../../assets/jquery/jquery.js"></script> <script src="../../../../../www/assets/vendors/jquery/jquery.js"></script>
<script src="../../../assets/jquery.ui/jquery-ui.js"></script> <script src="../../../../../www/assets/vendors/jquery-ui/jquery-ui.js"></script>
<script src="../../../assets/qunit/qunit.js"></script> <script src="../../../../../www/bower_components/qunit/qunit/qunit.js"></script>
<script src="../../../assets/blueimp-load-image/load-image.js"></script> <script src="../../../../../www/assets/vendors/blueimp-load-image/load-image.js"></script>
<script src="../../../skins/prod/jquery.Upload.js"></script> <script src="../jquery.Upload.js"></script>
<link type="text/css" rel="stylesheet" href="../../../assets/qunit/qunit.css"/> <link type="text/css" rel="stylesheet" href="../../../../../www/bower_components/qunit/qunit/qunit.css"/>
<script> $(document).ready(function(){ <script> $(document).ready(function(){
var getUploadManager = function(){ var getUploadManager = function(){

View File

@@ -3,13 +3,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Mocha Spec Runner</title> <title>Mocha Spec Runner</title>
<link rel="stylesheet" href="../../assets//mocha/mocha.css"> <link rel="stylesheet" href="../../bower_components/mocha/mocha.css">
</head> </head>
<body> <body>
<div id="mocha"></div> <div id="mocha"></div>
<script src="../../assets/mocha/mocha.js"></script> <script src="../../bower_components/mocha/mocha.js"></script>
<script src="../../assets/sinonjs/sinon.js"></script> <script src="../../bower_components/sinonjs/sinon.js"></script>
<script src="../../assets/requirejs/require.js"></script> <script src="../../assets/vendors/requirejs/require.js"></script>
<script src="common.js"></script> <script src="common.js"></script>
<script type="text/javascript"> <script type="text/javascript">
mocha.setup({ mocha.setup({

View File

@@ -1,23 +1,36 @@
require.config({ require.config({
baseUrl: "../../scripts", baseUrl: "../../scripts",
paths: { paths: {
"chai" : "../assets/chai/chai", "chai" : "../bower_components/chai/chai",
"fixtures": "../assets/js-fixtures/fixtures", "fixtures": "../bower_components/js-fixtures/fixtures",
"jquery": "../assets/jquery/jquery", jquery: "../assets/vendors/jquery/jquery.min",
"backbone": "../assets/backbone-amd/backbone", underscore: "../assets/vendors/underscore/underscore.min",
"i18n": "../assets/i18next/i18next.amd-1.6.3", backbone: "../assets/vendors/backbone/backbone.min",
"bootstrap": "../assets/bootstrap/js/bootstrap.min", i18n: "../assets/vendors/i18next/i18next.min",
"sinonchai": "../assets/sinon-chai/sinon-chai", bootstrap: "../assets/vendors/bootstrap/js/bootstrap.min",
"squire": "../assets/squire/Squire", "sinonchai": "../bower_components/sinon-chai/lib/sinon-chai",
"jquery.ui": "../assets/jquery.ui/jquery-ui", "squire": "../bower_components/squire/src/Squire",
"underscore": "../assets/underscore-amd/underscore", "jquery.ui": "../assets/vendors/jquery-ui/jquery-ui.min",
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget", "jquery.ui.widget": "../assets/vendors/jquery-file-upload/jquery.ui.widget.min",
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie", "jquery.cookie": "../assets/vendors/jquery.cookie/jquery.cookie.min",
"jquery.treeview": "../assets/vendors/jquery-treeview/jquery.treeview", "jquery.treeview": "../assets/vendors/jquery-treeview/jquery.treeview",
"jquery.tooltip": "../include/jquery.tooltip", //"jquery.tooltip": "../include/jquery.tooltip",
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image", "blueimp.loadimage" : "../assets/vendors/blueimp-load-image/load-image",
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport", "jfu.iframe-transport": "../assets/vendors/jquery-file-upload/jquery.iframe-transport",
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload" "jfu.fileupload": "../assets/vendors/jquery-file-upload/jquery.fileupload",
//"jquery.geonames": "../assets/vendors/jquery.geonames/jquery.geonames",
//"jquery.tooltip": "../include/jquery.tooltip",
}, },
shim: { shim: {
"jquery.ui": { "jquery.ui": {
@@ -34,13 +47,10 @@ require.config({
deps: ["jquery"], deps: ["jquery"],
exports: '$.fn.cookie' exports: '$.fn.cookie'
}, },
"jquery.tooltip": { /*"jquery.tooltip": {
deps: ["jquery"], deps: ["jquery"],
exports: '$.fn.tooltip' exports: '$.fn.tooltip'
}, },*/
"jquery.ui": {
deps: ["jquery"]
},
"jquery.ui.widget": { "jquery.ui.widget": {
deps: ["jquery"] deps: ["jquery"]
}, },

View File

@@ -3,13 +3,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Mocha Spec Runner</title> <title>Mocha Spec Runner</title>
<link rel="stylesheet" href="../../assets/mocha/mocha.css"> <link rel="stylesheet" href="../../bower_components/mocha/mocha.css">
</head> </head>
<body> <body>
<div id="mocha"></div> <div id="mocha"></div>
<script src="../../assets/mocha/mocha.js"></script> <script src="../../bower_components/mocha/mocha.js"></script>
<script src="../../assets/sinonjs/sinon.js"></script> <script src="../../bower_components/sinonjs/sinon.js"></script>
<script src="../../assets/requirejs/require.js"></script> <script src="../../assets/vendors/requirejs/require.js"></script>
<script src="common.js"></script> <script src="common.js"></script>
<script> <script>
mocha.setup({ mocha.setup({

View File

@@ -3,13 +3,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Mocha Spec Runner</title> <title>Mocha Spec Runner</title>
<link rel="stylesheet" href="../../assets/mocha/mocha.css"> <link rel="stylesheet" href="../../bower_components/mocha/mocha.css">
</head> </head>
<body> <body>
<div id="mocha"></div> <div id="mocha"></div>
<script src="../../assets/mocha/mocha.js"></script> <script src="../../bower_components/mocha/mocha.js"></script>
<script src="../../assets/sinonjs/sinon.js"></script> <script src="../../bower_components/sinonjs/sinon.js"></script>
<script src="../../assets/requirejs/require.js"></script> <script src="../../assets/vendors/requirejs/require.js"></script>
<script src="common.js"></script> <script src="common.js"></script>
<script> <script>
mocha.setup({ mocha.setup({

View File

@@ -3,13 +3,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Mocha Spec Runner</title> <title>Mocha Spec Runner</title>
<link rel="stylesheet" href="../../assets/mocha/mocha.css"> <link rel="stylesheet" href="../../bower_components/mocha/mocha.css">
</head> </head>
<body> <body>
<div id="mocha"></div> <div id="mocha"></div>
<script src="../../assets/mocha/mocha.js"></script> <script src="../../bower_components/mocha/mocha.js"></script>
<script src="../../assets/sinonjs/sinon.js"></script> <script src="../../bower_components/sinonjs/sinon.js"></script>
<script src="../../assets/requirejs/require.js"></script> <script src="../../assets/vendors/requirejs/require.js"></script>
<script src="common.js"></script> <script src="common.js"></script>
<script> <script>
mocha.setup({ mocha.setup({