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

feat(rules): add support for function declaration as test case #504

Conversation

blake-newman
Copy link
Contributor

Add support for the following test file structure.

test('my test', myTest)

function myTest() {
  expect(true).toBe(true)
}

Methods that are directly referenced will be ananalyzed for the
following rules expect-expect no-if no-test-return-statement,
no-try-expect

@blake-newman blake-newman force-pushed the blake.newman/add-support-for-function-declaration branch from 3eb69ad to 52b05c8 Compare January 6, 2020 16:49
Copy link
Collaborator

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers! I've commented on a few things to be actioned :)

src/rules/utils.ts Outdated Show resolved Hide resolved
src/rules/utils.ts Outdated Show resolved Hide resolved
@blake-newman blake-newman force-pushed the blake.newman/add-support-for-function-declaration branch 2 times, most recently from 6aac2a8 to 55caaed Compare January 7, 2020 12:57
@blake-newman
Copy link
Contributor Author

@G-Rath Thanks for the fast review; i have now updated based on your requested changes and ensured coverage in tests meets 100%

src/rules/utils.ts Outdated Show resolved Hide resolved
@blake-newman blake-newman force-pushed the blake.newman/add-support-for-function-declaration branch from 55caaed to 0d11f9a Compare January 8, 2020 10:16
src/rules/utils.ts Outdated Show resolved Hide resolved
Add support for the following test file structure.

```js
test('my test', myTest)

function myTest() {
  expect(true).toBe(true)
}
```

Methods that are directly referenced will be ananalyzed for the
following rules `expect-expect` `no-if` `no-test-return-statement`,
`no-try-expect`
@blake-newman blake-newman force-pushed the blake.newman/add-support-for-function-declaration branch from 0d11f9a to c4f7f87 Compare January 8, 2020 11:42
@G-Rath G-Rath merged commit ac7fa48 into jest-community:master Jan 10, 2020
github-actions bot pushed a commit that referenced this pull request Jan 10, 2020
# [23.4.0](v23.3.0...v23.4.0) (2020-01-10)

### Features

* **expect-expect:** support chained function names ([#471](#471)) ([#508](#508)) ([beb1aec](beb1aec))
* **rules:** add support for function declaration as test case ([#504](#504)) ([ac7fa48](ac7fa48))
@github-actions
Copy link

🎉 This PR is included in version 23.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants