Restrict modifier chaining#1670
Conversation
62879c4 to
255be17
Compare
|
Finished the TS refactor and did a similar one for Flow too. Also wrote some documentation for Flow, though still need to add the best way of stripping the type annotations. Will file a follow-up ticket for that too. |
255be17 to
4175186
Compare
|
I've documented how to strip flow type annotations and improved typings for |
| return Object.assign(test, runner.chain); | ||
| }; | ||
|
|
||
| // Support ComonJS modules by exporting a test function that can be fully |
|
|
||
| // Support ComonJS modules by exporting a test function that can be fully | ||
| // chained. Also support ES module loaders by exporting __esModule and a | ||
| // default. Support `import {* as ava} from 'ava'` use cases by exporting a |
There was a problem hiding this comment.
import {* as ava} from 'ava' => import * as ava from 'ava'
|
Good to see this being cleaned up before the 1.0 release. |
|
Can you open an issue on |
|
@sindresorhus Thanks. Will make the fixes and open follow-up issues. Will sneak in TypeScript 2.7 as well. I'm considering revisiting the |
Explicitly specify allowable chains, with some ground rules in mind: Test chaining rules: * `serial` must come at the start * `only` and `skip` must come at the end * `failing` must come at the end, but can be followed by `only` and `skip` * `only` and `skip` cannot be chained together * no repeating Hook chaining rules: * `always` comes immediately after "after hooks" * `skip` must come at the end * no `only` * no repeating Additionally: * `todo` cannot be chained, except after `serial` * hooks are not available on `serial` This commit also removes now unnecessary assertions from TestCollection. Fixes #1182.
Remove the need for a build step. Update the `throws` and `notThrows` assertions, adding `Observable` and allowing the returned error to be typed. Remove the inline documentation, to be added later. Simplify typing of `t.context`. Reassigning the `test` method along with a type cast is now sufficient. Update to TypeScript 2.7.1.
Minor syntactical changes aside, it's now equivalent to the TypeScript definition!
4175186 to
d07fb0c
Compare
Explicitly specify allowable chains, with some ground rules in mind:
Test chaining rules:
serialmust come at the startonlyandskipmust come at the endfailingmust come at the end, but can be followed byonlyandskiponlyandskipcannot be chained togetherHook chaining rules:
alwayscomes immediately after "after hooks"skipmust come at the endonlyAdditionally:
todocannot be chained, except afterserialserialThis commit also removes now unnecessary assertions from TestCollection.
Fixes #1182.
This allows the TypeScript definition to be simplified. I've done an initial refactor. Note that I've not included any JSDoc comments. I think we can do a lot better than we what we had before but I didn't want to sort that out just yet. Will open a follow-up ticket. I have fixed
throws/notThrowstaking observables. Would be nice to get a better type definition forObservablethough. Will ask more explicitly in a follow-up ticket.Observabletyping in TS and Floweslint-plugin-avato check chains when linting