Skip to content

Commit 6c52be5

Browse files
author
caoxinke
committed
2 parents 2b30f10 + a79a9f6 commit 6c52be5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

karma.conf.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ module.exports = function (config) {
1616
// list of files patterns to load in the browser
1717
// include:false表示不包含这些文件到浏览器中,注意添加顺序
1818
files: [
19-
19+
{pattern: 'src/legacy/libs/SuperMap_Basic-8.1.1-14426.js', include: false},
2020
/***legacy文件夹下的源码添加至此***/
2121
{pattern: 'src/legacy/libs/SuperMap_Basic-8.1.1-14426.js', include: false},
2222
{pattern: 'src/legacy/libs/Lang/*.js', include: false},
2323
{pattern: 'src/legacy/theme/default/*.css', include: false},
24-
24+
'./node_modules/whatwg-fetch/fetch.js',
25+
'./node_modules/fetch-jsonp/build/fetch-jsonp.js',
2526
/***common文件夹下的源码添加至此***/
2627
'src/common/Base.js',
2728
'src/common/REST.js',
2829
'src/common/style/CartoCSS.js',
30+
2931
'src/common/**/*.js',
3032

3133
/***Leaflet文件夹下的源码添加至此,暂未添加***/
@@ -102,15 +104,16 @@ module.exports = function (config) {
102104
// list of files to exclude 测试时排除的文件
103105
exclude: [
104106
//暂时先排除(因为Request引用了node_modules中的库,但在karma下识别不到路径,暂时找不到解决办法)
105-
'src/common/util/Request.js',
106-
'src/common/online/*.js'
107+
107108
],
108109

109110

110111
// preprocess matching files before serving them to the browser
111112
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
112113
preprocessors: {
113114
'src/legacy/libs/SuperMap_Basic-8.1.1-14426.js': ['commonjs'],
115+
'./node_modules/whatwg-fetch/fetch.js': ['commonjs'],
116+
'./node_modules/fetch-jsonp/build/fetch-jsonp.js': ['commonjs'],
114117
'src/legacy/libs/Lang/*.js': ['commonjs'],
115118
'src/common/**/*.js': ['commonjs', 'coverage'],
116119
'test/common/**/*Spec.js': ['commonjs']

src/common/util/Request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require("whatwg-fetch");
2-
var fetchJsonp = require('fetch-jsonp');
1+
require("whatwg-fetch/fetch");
2+
var fetchJsonp = require('fetch-jsonp/build/fetch-jsonp');
33

44
SuperMap.Request = SuperMap.Class({
55

0 commit comments

Comments
 (0)