Javascript 茉莉花试验嵌套角承诺不返回承诺
我正在尝试编写一个包含嵌套承诺的测试。由于某种原因,承诺永远不会回来 比如说Javascript 茉莉花试验嵌套角承诺不返回承诺,javascript,angularjs,jasmine,Javascript,Angularjs,Jasmine,我正在尝试编写一个包含嵌套承诺的测试。由于某种原因,承诺永远不会回来 比如说 describe('Some tests', function () { it("Should complete the test with the nested promises", function(done) { inject(function (SomeService, $rootScope) { SomeService.somePromi
describe('Some tests', function ()
{
it("Should complete the test with the nested promises", function(done)
{
inject(function (SomeService, $rootScope)
{
SomeService.somePromise().then(function(err)
{
console.log("Message 1");
expect(err).toBeNull();
SomeService.someOtherPromise.then(function(res)
{
console.log("Message 2");
// Check some data
done();
});
});
$rootScope.$digest();
});
});
});
奇怪的是,如果这个测试是自己运行的,它就通过了。但如果这些测试不止一个,它就会失败
当测试失败时,第一个承诺似乎永远不会兑现。所以我们甚至看不到第一条控制台消息。
我的问题是如何运行这种测试,以及为什么它不能正常工作