美文网首页
js.Promise

js.Promise

作者: 许道龙 | 来源:发表于2016-07-15 09:48 被阅读0次
var assert = require('power-assert');

describe('Basic Test', function () {

    it("should use `done` for test?", function (done) {
        var promise = Promise.resolve();
        promise.then(function (value) {
            assert(false);
        }).then(done, done);
    });

});

第二种写法

it("should be fail", function () {
    return Promise.resolve().then(function () {
        assert(false);// => 测试失败
    });
});

相关文章

  • js.Promise

    第二种写法

  • js.Promise catch

    代替catch ``由于 catch 标识符可能会导致问题出现,因此一些类库(Library)也采用了 caugh...

  • js.Promise race

    Promise.race(iterable),iterable[]-->指多个Promise值 返回第一个被确认(...

  • js.Promise resolve()

    功能一:Promise.resolve();立即让promise进行resolve的状态,并返回Promise 相...

  • js.Promise Thenable

    类似Promise 具有.then 方法的对象 JQuery.ajax() 返回值就是thenable,即是jqX...

  • js.Promise all

    Promise.all(func1, func2 [,funcN]) 两个或两个以上,仅在所有指定承诺均完成 或者...

  • js.Promise 传值

  • js.Promise 简介及例子

    用于管理与异步API交互的抽象对象,避免使用回调函数的层层嵌套 状态:等待->完成->拒绝 必须有一个then()...

  • js.Promise 解决地狱回调

    之前见过的一道Promise面试题的答案

网友评论

      本文标题:js.Promise

      本文链接:https://www.haomeiwen.com/subject/tqryjttx.html