Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tests structure #695

Open
yangshun opened this issue Jan 11, 2018 · 6 comments
Open

Improve tests structure #695

yangshun opened this issue Jan 11, 2018 · 6 comments

Comments

@yangshun
Copy link
Member

yangshun commented Jan 11, 2018

When jestjs/jest#5154 gets released, we should probably relook at our describe and test blocks. Some of them do not have a top level describe and phrasing is inconsistent across the various tests. This is a good chance to clean them up.

Proposed format:

  • Top-level describe with the component name that you are testing for.
  • For testing methods, use MyComponent.myMethod.

Feel free to add on to this. The purpose is to make them consistent across the code base.

@ZhangYiJiang
Copy link
Member

This should be ready to be worked on, because Jest 22.0.5 has that PR, and we're using 22.3.0

@li-kai
Copy link
Member

li-kai commented Feb 19, 2018

Leaving this here: https://www.npmjs.com/package/jest-codemods

@ZhangYiJiang
Copy link
Member

Is that smart enough for our purpose? It seems like it's used for migrating tests from other frameworks to Jest

@ZhangYiJiang
Copy link
Member

Just did a test and it seems that Flow libdef for Jest has not been updated to support this unfortunately. Let me see if I can make a PR for this.

@li-kai
Copy link
Member

li-kai commented Feb 19, 2018

I just realized there is no need to write a codeshift to convert top level 'test' to 'describe'. We can just use regex.

@ZhangYiJiang
Copy link
Member

PR opened on flow-typed - flow-typed/flow-typed#1858

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

No branches or pull requests

3 participants