2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

Using webpack for testing

This commit is contained in:
mzabriskie
2015-03-18 10:45:06 -06:00
parent dfa816df9b
commit b745600ab7
11 changed files with 28 additions and 5 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ module.exports = function(grunt) {
}
});
grunt.registerTask('test', 'Run the jasmine and nodeunit tests', ['eslint', 'webpack:global', 'nodeunit', 'karma:single', 'ts']);
grunt.registerTask('test', 'Run the jasmine and nodeunit tests', ['eslint', 'nodeunit', 'karma:single', 'ts']);
grunt.registerTask('build', 'Run webpack and bundle the source', ['webpack']);
grunt.registerTask('publish', 'Prepare the code for release', ['clean', 'test', 'build', 'usebanner', 'update_json']);
};
+9 -3
View File
@@ -15,8 +15,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
'dist/axios.js',
'test/specs/**/*.spec.js'
'webpack.tests.js'
],
@@ -29,7 +28,12 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'dist/axios.js': 'coverage'
'webpack.tests.js': ['webpack', 'sourcemap', 'coverage']
},
webpack: {
devtool: 'inline-source-map'
},
@@ -38,12 +42,14 @@ module.exports = function(config) {
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'lcov',
dir: 'coverage/',
subdir: '.'
},
// web server port
port: 9876,
+1
View File
@@ -45,6 +45,7 @@
"karma-jasmine": "^0.3.5",
"karma-jasmine-ajax": "^0.1.12",
"karma-phantomjs-launcher": "^0.1.4",
"karma-webpack": "^1.5.0",
"load-grunt-tasks": "^3.1.0",
"webpack": "^1.7.2",
"webpack-dev-server": "^1.7.0"
+3 -1
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('api', function () {
it('should have request method helpers', function () {
expect(typeof axios.get).toEqual('function');
@@ -26,4 +28,4 @@ describe('api', function () {
expect(typeof axios.all).toEqual('function');
expect(typeof axios.spread).toEqual('function');
});
});
});
+2
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('interceptors', function () {
beforeEach(function () {
jasmine.Ajax.install();
+2
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('options', function () {
beforeEach(function () {
jasmine.Ajax.install();
+2
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('promise', function () {
beforeEach(function () {
jasmine.Ajax.install();
+2
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('transform', function () {
beforeEach(function () {
jasmine.Ajax.install();
+2
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('wrapper', function () {
beforeEach(function () {
jasmine.Ajax.install();
+2
View File
@@ -1,3 +1,5 @@
var axios = require('../../index');
describe('xsrf', function () {
beforeEach(function () {
jasmine.Ajax.install();
+2
View File
@@ -0,0 +1,2 @@
var context = require.context('./test/specs', true, /\.js$/);
context.keys().forEach(context);