mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +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('build', 'Run webpack and bundle the source', ['webpack']);
|
||||||
grunt.registerTask('publish', 'Prepare the code for release', ['clean', 'test', 'build', 'usebanner', 'update_json']);
|
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
|
// list of files / patterns to load in the browser
|
||||||
files: [
|
files: [
|
||||||
'dist/axios.js',
|
'webpack.tests.js'
|
||||||
'test/specs/**/*.spec.js'
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +28,12 @@ module.exports = function(config) {
|
|||||||
// preprocess matching files before serving them to the browser
|
// preprocess matching files before serving them to the browser
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
preprocessors: {
|
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
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
reporters: ['progress', 'coverage'],
|
reporters: ['progress', 'coverage'],
|
||||||
|
|
||||||
|
|
||||||
coverageReporter: {
|
coverageReporter: {
|
||||||
type: 'lcov',
|
type: 'lcov',
|
||||||
dir: 'coverage/',
|
dir: 'coverage/',
|
||||||
subdir: '.'
|
subdir: '.'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// web server port
|
// web server port
|
||||||
port: 9876,
|
port: 9876,
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"karma-jasmine": "^0.3.5",
|
"karma-jasmine": "^0.3.5",
|
||||||
"karma-jasmine-ajax": "^0.1.12",
|
"karma-jasmine-ajax": "^0.1.12",
|
||||||
"karma-phantomjs-launcher": "^0.1.4",
|
"karma-phantomjs-launcher": "^0.1.4",
|
||||||
|
"karma-webpack": "^1.5.0",
|
||||||
"load-grunt-tasks": "^3.1.0",
|
"load-grunt-tasks": "^3.1.0",
|
||||||
"webpack": "^1.7.2",
|
"webpack": "^1.7.2",
|
||||||
"webpack-dev-server": "^1.7.0"
|
"webpack-dev-server": "^1.7.0"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('api', function () {
|
describe('api', function () {
|
||||||
it('should have request method helpers', function () {
|
it('should have request method helpers', function () {
|
||||||
expect(typeof axios.get).toEqual('function');
|
expect(typeof axios.get).toEqual('function');
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('interceptors', function () {
|
describe('interceptors', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('options', function () {
|
describe('options', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('promise', function () {
|
describe('promise', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('transform', function () {
|
describe('transform', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('wrapper', function () {
|
describe('wrapper', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var axios = require('../../index');
|
||||||
|
|
||||||
describe('xsrf', function () {
|
describe('xsrf', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
jasmine.Ajax.install();
|
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