节点 ava,t.context 在测试前不可用
node ava, t.context is not available in before test
根据自述文件,此测试应该有效:
test.before(t => {
t.context = 'unicorn';
});
但它 returns 返回:
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
请检查this answer。
您在 GitHub 上看到的文档与版本 1.0.0-beta.3 not to the stable release that was published to npm(即 0.25.0)相关。
正如您所看到的版本 0.25.0
上下文仅在 .beforeEach
挂钩中可用。
如果您想在 .before
中使用它,您必须安装最新的测试版:
npm i ava@next --save-dev
根据自述文件,此测试应该有效:
test.before(t => {
t.context = 'unicorn';
});
但它 returns 返回:
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
请检查this answer。
您在 GitHub 上看到的文档与版本 1.0.0-beta.3 not to the stable release that was published to npm(即 0.25.0)相关。
正如您所看到的版本 0.25.0
上下文仅在 .beforeEach
挂钩中可用。
如果您想在 .before
中使用它,您必须安装最新的测试版:
npm i ava@next --save-dev