Skip to content
This repository was archived by the owner on Jan 11, 2019. It is now read-only.

Conversion for Mocha #3

Closed
jamestalmage opened this issue Apr 2, 2016 · 1 comment
Closed

Conversion for Mocha #3

jamestalmage opened this issue Apr 2, 2016 · 1 comment

Comments

@jamestalmage
Copy link
Contributor

From avajs/ava#644

@spudly has a start here: https://astexplorer.net/#/Uwl4f415pa

For completeness, here's a list of everything that I think would be needed for a complete mocha codemod:

  • transform it() to test()
  • add t parameter to a ArrowFunctionExpression passed to test()
  • don't de-sync async functions (the codemod above will mess those up currently)
  • add t parameter to a FunctionExpression passed to test()
  • transform beforeEach() to test.beforeEach()
  • transform afterEach() to test.afterEach()
  • transform after() to test.after()
  • transform before() to test.before()
  • remove describe() blocks, prepending their text to each test block's description
  • intelligently handle nested describe blocks if possible. how do we handle nested describe blocks with their own lifecycle hooks?
  • if the test body FunctionExpression or ArrowFunctionExpression is async, it should use test.serial instead of test

Also, it would be nice to have a separate codemod to transform chai assertions to ava assertions.

@spudly - avajs/ava#644 (comment)

  • Transform tests containing a callback ( it('foo', function (done) { ... }) ) to test.cb(t => ... t.end();

@jfmengels - avajs/ava#644 (comment)

@jamestalmage
Copy link
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants