avajs/ava

Implement .because() modifier for irregular tests

Open

#3,227 opened on 2023年7月30日

GitHub で見る
 (14 comments) (0 reactions) (0 assignees)JavaScript (20,600 stars) (1,408 forks)batch import
enhancementhelp wantedscope:test-interface

説明

Based on discussion with @tommy-mitchell in https://github.com/avajs/ava/discussions/3224:

test.failing('does foo', t => {
  // ..
}).because('waiting on some/repo#123')

Should output:

✔ [expected fail] does foo
  - waiting on some/repo#123

This requires changes to https://github.com/avajs/ava/blob/main/lib/create-chain.js so that a chainable object is returned for test.failing(), test.skip() etc. Here we then need to add a because function. The reason should make its way to the reporter where it can be printed beneath the test title.

This should be reflected in the type definitions and documentation. Once we've made some progress on this, work needs to be done with https://github.com/avajs/eslint-plugin-ava to support this new modifier.

It should be a test failure if because() is called with anything but a non-empty string.

コントリビューターガイド