所以我使用 mocha 和 node 来测试一些 api。我有一个测试
import { describe, before, it, xit } from 'mocha';
describe('test my scenarios dude', () => {
   before('do all my pre-test stuff', () => {
     const blah = blah;
   });
   it('tests my really useful test', () => {
     const testName = this.test.ctx.currentTest.fullTitle();
   });
});
但“这个”是未定义的。我如何获得测试名称?
https://mochajs.org/#arrow-functions
\n\n正如文档所说Passing arrow functions (\xe2\x80\x9clambdas\xe2\x80\x9d) to Mocha is discouraged\nfunction使用
describe(\'test my scenarios dude\', function() {\n   before(\'do all my pre-test stuff\', function() {\n     const blah = blah;\n   });\n\n   it(\'tests my really useful test\', function() {\n     const testName = this.test.ctx.currentTest.fullTitle();\n   });\n});\n您还可以在此处阅读有关箭头函数的更多信息。他们没有this
| 归档时间: | 
 | 
| 查看次数: | 3320 次 | 
| 最近记录: |