第一次通过const re = /\b\s*\.\s*\b/g;
const str = ` I saw the dog. But I didn't care.`;
const str2 = `The duck didn't see it coming...`;
const str3 = `This is not....the end. this is. not the beginning Linking Park`;
var found = str.split(re);
var found2 = str2.split(re);
var found3 = str3.split(re);
console.log(found);
console.log(found2);
console.log(found3);
运行平稳且快速(70次测试为2-3秒)。但是当一个更改触发观察者重新编译时,ng test
将花费1-2秒来完成每个测试,使整个过程花费指数更长。
这是我们(仍然相对较小)项目的独特之处还是其他人体验过这个?是否有解决方案,甚至只是一种诊断导致减速的方法?
感谢您的帮助!
答案 0 :(得分:1)
好的......找到了解决方案。
如果您在屏幕上看到Chrome窗口(至少有1个像素),则它会全速运行。
只要Chrome不可见(被其他窗口隐藏或最小化),测试就会很慢。
https://github.com/karma-runner/karma-chrome-launcher/issues/81