Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5fa99b5

Browse files
SimenBSunil Pai
authored and
Sunil Pai
committed
chore: add eslint-plugin-jest's valid-expect rule (facebook#16332)
* chore: add eslint-plugin-jest's valid-expect rule * update assertion
1 parent a34ca7b commit 5fa99b5

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ module.exports = {
129129
rules: {
130130
// https://github.com/jest-community/eslint-plugin-jest
131131
'jest/no-focused-tests': ERROR,
132+
'jest/valid-expect': ERROR,
133+
'jest/valid-expect-in-promise': ERROR,
132134
},
133135
},
134136
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"eslint": "^6.1.0",
4949
"eslint-config-fbjs": "^1.1.1",
5050
"eslint-plugin-flowtype": "^2.25.0",
51-
"eslint-plugin-jest": "^21.6.1",
51+
"eslint-plugin-jest": "^22.15.0",
5252
"eslint-plugin-no-for-of-loops": "^1.0.0",
5353
"eslint-plugin-babel": "^5.3.0",
5454
"eslint-plugin-react": "^6.7.1",

packages/react-dom/src/__tests__/ReactDOMComponent-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ describe('ReactDOMComponent', () => {
10401040
if (typeof value !== 'undefined') {
10411041
re += quoteRegexp(value) + '[\\\'"]';
10421042
}
1043-
expect(new RegExp(re).test(actual)).toBe(true);
1043+
expect(actual).toMatch(new RegExp(re));
10441044
}
10451045

10461046
function genMarkup(props) {

yarn.lock

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,33 @@
571571
dependencies:
572572
"@types/whatwg-streams" "^0.0.6"
573573

574+
"@types/json-schema@^7.0.3":
575+
version "7.0.3"
576+
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
577+
integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==
578+
574579
"@types/whatwg-streams@^0.0.6":
575580
version "0.0.6"
576581
resolved "https://registry.yarnpkg.com/@types/whatwg-streams/-/whatwg-streams-0.0.6.tgz#5062c67efb695c886fe3dbb9618df35aac418503"
577582
integrity sha512-O4Hat94N1RUCObqAbVUtd6EcucseqBcpfbFXzy12CYF6BQVHWR+ztDA3YPjewCmdKHYZ5VA7TZ5hq2bMyqxiBw==
578583

584+
"@typescript-eslint/experimental-utils@^1.13.0":
585+
version "1.13.0"
586+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e"
587+
integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==
588+
dependencies:
589+
"@types/json-schema" "^7.0.3"
590+
"@typescript-eslint/typescript-estree" "1.13.0"
591+
eslint-scope "^4.0.0"
592+
593+
"@typescript-eslint/[email protected]":
594+
version "1.13.0"
595+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
596+
integrity sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw==
597+
dependencies:
598+
lodash.unescape "4.0.1"
599+
semver "5.5.0"
600+
579601
abab@^1.0.4:
580602
version "1.0.4"
581603
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e"
@@ -2104,10 +2126,12 @@ eslint-plugin-flowtype@^2.25.0:
21042126
dependencies:
21052127
lodash "^4.17.10"
21062128

2107-
eslint-plugin-jest@^21.6.1:
2108-
version "21.27.2"
2109-
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.27.2.tgz#2a795b7c3b5e707df48a953d651042bd01d7b0a8"
2110-
integrity sha512-0E4OIgBJVlAmf1KfYFtZ3gYxgUzC5Eb3Jzmrc9ikI1OY+/cM8Kh72Ti7KfpeHNeD3HJNf9SmEfmvQLIz44Hrhw==
2129+
eslint-plugin-jest@^22.15.0:
2130+
version "22.15.0"
2131+
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.15.0.tgz#fe70bfff7eeb47ca0ab229588a867f82bb8592c5"
2132+
integrity sha512-hgnPbSqAIcLLS9ePb12hNHTRkXnkVaCfOwCt2pzQ8KpOKPWGA4HhLMaFN38NBa/0uvLfrZpcIRjT+6tMAfr58Q==
2133+
dependencies:
2134+
"@typescript-eslint/experimental-utils" "^1.13.0"
21112135

21122136
eslint-plugin-no-for-of-loops@^1.0.0:
21132137
version "1.0.1"
@@ -2141,6 +2165,14 @@ [email protected]:
21412165
esrecurse "^4.1.0"
21422166
estraverse "^4.1.1"
21432167

2168+
eslint-scope@^4.0.0:
2169+
version "4.0.3"
2170+
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
2171+
integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==
2172+
dependencies:
2173+
esrecurse "^4.1.0"
2174+
estraverse "^4.1.1"
2175+
21442176
eslint-scope@^5.0.0:
21452177
version "5.0.0"
21462178
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"
@@ -3939,6 +3971,11 @@ lodash.sortby@^4.7.0:
39393971
version "4.7.0"
39403972
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
39413973

3974+
3975+
version "4.0.1"
3976+
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
3977+
integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=
3978+
39423979
lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.2.0:
39433980
version "4.17.10"
39443981
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
@@ -5106,7 +5143,7 @@ scheduler@^0.11.0:
51065143
loose-envify "^1.1.0"
51075144
object-assign "^4.1.1"
51085145

5109-
"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
5146+
"semver@2 || 3 || 4 || 5", semver@5.5.0, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
51105147
version "5.5.0"
51115148
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
51125149

0 commit comments

Comments
 (0)