Fix dependencies.
Added webpack.
This commit is contained in:
parent
a1dc06cf4b
commit
8fd20a0f35
113
Gruntfile.js
113
Gruntfile.js
@ -1,3 +1,5 @@
|
||||
var webpackConfig = require('./webpack.config');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
@ -8,78 +10,67 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
stop_node: { stop: {} },
|
||||
|
||||
run: {
|
||||
installBower: {
|
||||
cmd: 'node',
|
||||
args: [
|
||||
'./node_modules/bower/bin/bower',
|
||||
'install'
|
||||
]
|
||||
},
|
||||
killAllNodeWindows: {
|
||||
cmd: 'taskkill',
|
||||
args: [
|
||||
'/f',
|
||||
'/im',
|
||||
'node.exe'
|
||||
]
|
||||
},
|
||||
killAllNodeMac: {
|
||||
cmd: 'killall',
|
||||
args: [
|
||||
'node'
|
||||
]
|
||||
}
|
||||
stop_node: {
|
||||
stop: {}
|
||||
},
|
||||
|
||||
jasmine: {
|
||||
amd: {
|
||||
src: 'backbone-model-file-upload.js',
|
||||
host: 'http://localhost:8888/',
|
||||
headless: {
|
||||
options: {
|
||||
specs: ['test/*spec.js'],
|
||||
helpers: 'bower_components/Blob/Blob.js',
|
||||
//keepRunner: true,
|
||||
template: require('grunt-template-jasmine-requirejs'),
|
||||
templateOptions: {
|
||||
requireConfig: {
|
||||
paths: {
|
||||
"jquery": "bower_components/jquery/dist/jquery.min",
|
||||
"underscore": "bower_components/underscore/underscore-min",
|
||||
"backbone": "bower_components/backbone/backbone"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
browserGlobal: {
|
||||
src: 'backbone-model-file-upload.js',
|
||||
host: 'http://localhost:8888/',
|
||||
options: {
|
||||
specs: ['test/*spec.js'],
|
||||
//keepRunner: true,
|
||||
vendor: [
|
||||
"bower_components/Blob/Blob.js",
|
||||
"bower_components/jquery/dist/jquery.min.js",
|
||||
"bower_components/underscore/underscore-min.js",
|
||||
"bower_components/backbone/backbone.js"
|
||||
browser: 'chrome',
|
||||
headless: true,
|
||||
timeout: 20000,
|
||||
keepRunner: true,
|
||||
outfile: '_SpecRunner.html',
|
||||
host: 'http://localhost:8088',
|
||||
summary: true,
|
||||
display: 'short',
|
||||
reportSlowerThan: 2000,
|
||||
specs: [
|
||||
'.grunt/tests.specs.js'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
connect: {
|
||||
test: {
|
||||
options: {
|
||||
port: 8088,
|
||||
livereload: false,
|
||||
hostname: '0.0.0.0', // to be able to access the server not only from localhost
|
||||
base: {
|
||||
path: '.'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
specs: {
|
||||
options: {
|
||||
port: 8088,
|
||||
livereload: false,
|
||||
open: 'http://localhost:8088/_SpecRunner.html',
|
||||
hostname: '0.0.0.0',
|
||||
base: {
|
||||
path: '.'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
webpack: {
|
||||
options: {
|
||||
stats: false
|
||||
},
|
||||
test: webpackConfig
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-webpack');
|
||||
grunt.loadNpmTasks('grunt-contrib-jasmine');
|
||||
grunt.loadNpmTasks('grunt-run');
|
||||
grunt.loadNpmTasks('grunt-run-node');
|
||||
|
||||
grunt.registerTask('test', ['build','run_node','jasmine','stop_node']);
|
||||
grunt.registerTask('build', ['run:installBower']);
|
||||
grunt.registerTask('resetNodeWin', ['run:killAllNodeWindows']);
|
||||
grunt.registerTask('resetNodeMac', ['run:killAllNodeMac']);
|
||||
|
||||
grunt.registerTask('test', ['webpack:test', 'connect:test', 'run_node','jasmine','stop_node']);
|
||||
grunt.registerTask('test:browser', ['webpack:test', 'connect:specs', 'run_node','jasmine','stop_node']);
|
||||
};
|
17
package.json
17
package.json
@ -6,11 +6,6 @@
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dependencies": {
|
||||
"bower": "^1.3.12",
|
||||
"formidable": "~1.0.15",
|
||||
"lodash": "~2.4.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
@ -32,10 +27,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/homeslicesolutions/backbone-model-file-upload",
|
||||
"devDependencies": {
|
||||
"backbone": "1.2.3",
|
||||
"blob": "0.0.4",
|
||||
"grunt": "0.4.5",
|
||||
"grunt-contrib-jasmine": "1.1.0",
|
||||
"grunt-contrib-connect": "^1.0.2",
|
||||
"grunt-contrib-jasmine": "CartoDB/grunt-contrib-jasmine#headless-chrome",
|
||||
"grunt-run": "0.3.0",
|
||||
"grunt-run-node": "0.1.3",
|
||||
"grunt-template-jasmine-requirejs": "^0.2.0"
|
||||
"grunt-template-jasmine-requirejs": "^0.2.0",
|
||||
"grunt-webpack": "^3.0.2",
|
||||
"jquery": "2.1.4",
|
||||
"underscore": "1.8.3",
|
||||
"webpack": "^3.5.5",
|
||||
"formidable": "~1.0.15"
|
||||
}
|
||||
}
|
||||
|
10
webpack.config.js
Normal file
10
webpack.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
var path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './test/backbone-model-file-upload.spec.js',
|
||||
output: {
|
||||
path: path.resolve(path.resolve('.'), '.grunt'),
|
||||
filename: 'tests.specs.js'
|
||||
},
|
||||
devtool: 'inline-source-map'
|
||||
};
|
Loading…
Reference in New Issue
Block a user