我一直在设置棕褐色用于量角器.
它现在有效,这是我做的:
原文链接:https://www.f2er.com/angularjs/141147.html它现在有效,这是我做的:
我假设你已经设置了grunt-connect来运行你的量角器测试.
然后,您需要等待连接配置中的事件侦听事件:
grunt.event.once(‘connect.test.listening’,function)
这就是你要配置棕褐色的地方.
grunt.event.once('connect.test.listening',function(host,port) { /** * Configure sepia here */ var sepia = require('sepia').withSepiaServer(); // Use your custom configuration sepia.configure({ verbose: true,debug: true,includeHeaderNames: false,includeCookieNames: false }); // I have some path/body content to filter configured in the vrc configuration var bodyFilters = grunt.config('vcr.filters.body') ||[]; var pathFilters = grunt.config('vcr.filters.path') ||[]; var regexPath = function(string) { var escapedString = string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,'\\$&'); return new RegExp(escapedString); }; // Filter path _.map(pathFilters,function(filter) { sepia.filter({ url: regexPath(filter.path),urlFilter: function(url) { return url.replace(filter.pattern,filter.replacement); } }); }); // Filter body content _.map(bodyFilters,bodyFilter: function(body) { return body.replace(filter.pattern,filter.replacement); } }); }); }); });