Javascript 意外请求:在注入指令后,不需要发布更多请求

Javascript 意外请求:在注入指令后,不需要发布更多请求,javascript,angularjs,jasmine,karma-jasmine,e2e-testing,Javascript,Angularjs,Jasmine,Karma Jasmine,E2e Testing,我正在注入一个指令进行测试,如下所示: description('MyAppTest',function(){ 让埃伦; 让范围; 每个模块之前(模块('my.app'); beforeach(注入(函数($rootScope,$compile){ scope=$rootScope.$new(); 元素=$compile(“”)(范围)[0]; $scope.$digest(); })); 它('Should success',function(){ expect(elem.getElement

我正在注入一个指令进行测试,如下所示:

description('MyAppTest',function(){
让埃伦;
让范围;
每个模块之前(模块('my.app');
beforeach(注入(函数($rootScope,$compile){
scope=$rootScope.$new();
元素=$compile(“”)(范围)[0];
$scope.$digest();
}));
它('Should success',function(){
expect(elem.getElementById('some-id').childElementCount.not.toBe(0);
};
}
当我调试它时,
elem
变量实际上得到了我想要的指令,但是由于某种原因,测试抛出了这个错误:
意外请求:不需要更多的请求

some id
是一个具有ng repeat属性的div,受服务器请求
$http
的影响,但我没有使用
$httpBackend
,因此我不知道为什么会发生此错误

有人能弄明白为什么会这样


提前感谢!

这是你应用程序中唯一的测试吗?因为它可能会被另一个测试失效。如果是这种情况,请尝试通过编写“fdescribe”而不是“descripe”单独启动此测试,我的应用程序中有更多测试,我已经使用
fdescribe
@Cyril运行了
describe('MyAppTest', function() {
    let elem;
    let scope;

    beforeEach(module('my.app'));

    beforeEach(inject(function ($rootScope, $compile) {
        scope = $rootScope.$new();
        elem = $compile('<my-directive></my-directive>')(scope)[0];
        $scope.$digest();
    }));

    it('Should success', function () {
        expect(elem.getElementById('some-id').childElementCount.not.toBe(0);
    };
}