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:
+1
-1
@@ -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
@@ -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,
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('interceptors', function () {
|
||||
beforeEach(function () {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('options', function () {
|
||||
beforeEach(function () {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('promise', function () {
|
||||
beforeEach(function () {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('transform', function () {
|
||||
beforeEach(function () {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('wrapper', function () {
|
||||
beforeEach(function () {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('xsrf', function () {
|
||||
beforeEach(function () {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
var context = require.context('./test/specs', true, /\.js$/);
|
||||
context.keys().forEach(context);
|
||||
Reference in New Issue
Block a user