Commit f93389cc authored by Aurel's avatar Aurel

add a way to test jio in nodejs

parent 114045eb
......@@ -30,6 +30,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-qunitnode');
// Project configuration.
grunt.initConfig({
......@@ -68,6 +69,15 @@ module.exports = function (grunt) {
nomen: true
}
},
jio_nodejs: {
src: ['src/jio-nodejs.js'],
directives: {
maxlen: 80,
indent: 2,
maxerr: 3,
nomen: true
}
},
jio_storages: {
src: ['src/jio.storage/*.js'],
directives: {
......@@ -160,7 +170,7 @@ module.exports = function (grunt) {
'src/jio.date/*.js',
'src/jio.js',
'src/jio-nodejs.js',
'node_modules/rusha/rusha.js',
......@@ -189,6 +199,8 @@ module.exports = function (grunt) {
nodejs: {
// duplicate files are ignored
src: [
// require for nodejs
'src/include-nodejs.js',
// queries
'src/queries/parser-begin.js',
......@@ -199,6 +211,7 @@ module.exports = function (grunt) {
'src/jio.date/*.js',
'src/jio-nodejs.js',
// 'src/jio.js',
'src/jio.storage/replicatestorage.js',
'src/jio.storage/uuidstorage.js',
......@@ -253,6 +266,9 @@ module.exports = function (grunt) {
}, {
src: '<%= uglify.nodejs.src %>',
dest: "nodejs/lib/jio/<%= pkg.name %>.js"
}, {
src: '<%= uglify.nodejs.src %>',
dest: "nodejs/lib/jio/jio.js"
}, {
src: '<%= uglify.nodejs.dest %>',
dest: "nodejs/lib/jio/<%= pkg.name %>.min.js"
......@@ -263,7 +279,19 @@ module.exports = function (grunt) {
qunit: {
// grunt doesn't like requirejs
files: ['test/tests.html']
files: ['test/tests.html', 'test/tests-nodejs.html']
},
qunitnode: {
all: [ "nodejs/lib/jio/jio.js",
"test/jio.storage/memorystorage.tests.js",
"test/jio.storage/replicatestorage.tests.js",
"test/jio.storage/uuidstorage.tests.js",
"test/jio.storage/querystorage.tests.js",
"test/jio.storage/mappingstorage.tests.js",
"test/jio.storage/localstorage.tests.js",
"test/jio.storage/documentstorage.tests.js",
"test/jio.storage/erp5storage.tests.js",
]
},
watch: {
......@@ -279,7 +307,8 @@ module.exports = function (grunt) {
'<%= concat.jio.src %>',
'<%= qunit.files %>',
'test/**/*.js',
'examples/*'
'examples/*',
'src/*node*.js'
],
tasks: ['default'],
options: {
......
global.URI = require("urijs");
global.RSVP = require('rsvp');
global.UriTemplate = require("uritemplate");
global.moment = require('moment');
global.navigator = require('navigator');
global.Rusha = require('rusha');
global.FormData = require('form-data');
global.atob = require('atob');
global.FileReader = require("html5").FileReader;
global.Blob = require("html5").Blob;
var LocalStorage = require('node-localstorage').LocalStorage;
global.localStorage = new LocalStorage("tests");
global.btoa = require('btoa');
global.XMLHttpRequest = require('xhr2');
var mockdoc = require("mockdoc");
global.document = new mockdoc();
global.sinon = require('sinon');
global.StreamBuffers = require('stream-buffers');
global.window = global;
global.sessionStorage = {};
global.HTMLCanvasElement = {};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment