问题描述
我无法将业力配置为代理网站根目录中的文件。我的一个角度组件包含一个嵌入式Ace编辑器,该编辑器在http:// localhost:9876 / worker-html.js中查找文件。我已经使用files属性成功地在Karma中提供了文件
// Makes ace files available in tests
files: [
{ pattern: "../node_modules/ace-builds/src-min-noconflict/worker-html.js",watched: false,included:false,nocache:false,served:true }
],
并验证它是否已提供(通过检查window .__ karma__,它并不总是在karma浏览器窗口中定义,我不知道为什么,但这是一个单独的问题)。我还验证了可以在以下路径访问所需文件:
http://localhost:9876/absoluteD:/Evan/programming%20stuff/Projects/Gneus/node_modules/ace-builds/src-min-noconflict/worker-html.js
但是,我终生无法将其代理到所需的URL(http:// localhost:9876 / worker-html.js)。我已经尝试了我能想到的所有合理的代理配置,所以我认为我缺少一些基本知识。有人可以帮我吗?以下是整个业力配置文件供参考,其中包括我的最新代理尝试:
// Karma configuration file,see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',frameworks: ['jasmine','@angular-devkit/build-angular'],plugins: [
require('karma-jasmine'),require('karma-chrome-launcher'),require('karma-jasmine-html-reporter'),require('karma-coverage-istanbul-reporter'),require('@angular-devkit/build-angular/plugins/karma')
],client: {
clearContext: false,// leave Jasmine Spec Runner output visible in browser
// Don't run tests in random order
// If you update this,you have to restart ng test batch
jasmine: {
random: false
}
},// Makes ace files available in tests
files: [
{ pattern: "../node_modules/ace-builds/src-min-noconflict/worker-html.js",served:true }
],proxies: {
'/worker-html.js': "http://localhost:9876/absoluteD:/Evan/programming stuff/Gneus/node_modules/ace-builds/src-min-noconflict/worker-html.js"
},coverageIstanbulReporter: {
dir: require('path').join(__dirname,'../coverage'),reports: ['html','lcovonly'],fixWebpackSourcePaths: true
},reporters: ['progress','kjhtml'],port: 9876,colors: true,logLevel: config.LOG_INFO,autoWatch: true,browsers: ['Chrome'],singleRun: false,});
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)