【问题标题】:node ava, t.context is not available in before test节点 ava,t.context 在测试前不可用
【发布时间】:2018-02-22 11:29:55
【问题描述】:

按照自述文件,此测试应该可以工作:

test.before(t => { t.context = 'unicorn'; });

但它会返回: t.context is not available in before tests

我希望这会在 0.25 版本中实现,我做错了吗?

ava 版本:“0.25.0” Node.js v8.9.1 达尔文 17.4.0 npm --version 5.6

【问题讨论】:

    标签: javascript ava


    【解决方案1】:

    请查看this answer

    您在 GitHub 上看到的文档与版本 1.0.0-beta.3 相关,而不是发布到 npm(即 0.25.0)的稳定版本。

    如您所见,0.25.0 版本的上下文仅在 .beforeEach 挂钩中可用。

    如果你想在.before 中使用它,你必须安装最新的测试版:

    npm i ava@next --save-dev
    

    【讨论】:

      猜你喜欢
      • 2020-10-21
      • 1970-01-01
      • 1970-01-01
      • 2018-01-11
      • 2020-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多