chore: add eslint rules for skipped tests (#24164)

## Description
- Add a [package](https://github.com/jest-community/eslint-plugin-jest)
with a set of rules for jest.
- Add
[only](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-focused-tests.md)
and
[skip](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-disabled-tests.md)
check for tests
- Remove `only` in tests
- Suppress `skip` tests

Related PRS 
#24122 
#23991 

#### PR fixes following issue(s)
Fixes #23708
> if no issue exists, please create an issue and ask the maintainers
about this first

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [x] Jest
- [ ] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag

#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

Co-authored-by: Valera Melnikov <melnikov.vv@greendatasoft.ru>
This commit is contained in:
Valera Melnikov 2023-06-07 11:37:46 +03:00 committed by GitHub
parent ce01390f7e
commit 7a7b3888c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 146 additions and 56 deletions

View File

@ -9,7 +9,8 @@
"prettier",
"react-hooks",
"sort-destructure-keys",
"cypress"
"cypress",
"jest"
],
"extends": [
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
@ -38,6 +39,8 @@
"cypress/no-unnecessary-waiting": "off",
"cypress/no-assigning-return-values": "off",
"@typescript-eslint/no-unused-vars": "error",
"jest/no-focused-tests": "error",
"jest/no-disabled-tests": "error",
// enforce `import type` for all type-only imports so the bundler knows to erase them
"@typescript-eslint/consistent-type-imports": "error",
"react-hooks/rules-of-hooks": "error",

View File

@ -12,6 +12,7 @@
"prefer-const": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"cypress/unsafe-to-chain-command": "off",
"@typescript-eslint/adjacent-overload-signatures": "off"
"@typescript-eslint/adjacent-overload-signatures": "off",
"jest/no-disabled-tests": "off"
}
}

View File

@ -10,7 +10,7 @@ describe(
cy.addDsl(dsl);
});
it.only("1. Validate the Button binding with Text Widget with Recaptcha token with empty key", function () {
it("1. Validate the Button binding with Text Widget with Recaptcha token with empty key", function () {
_.agHelper.ClickButton("Submit");
_.agHelper
.GetText(_.locators._widgetInCanvas("textwidget") + " span")
@ -25,7 +25,7 @@ describe(
});
//This test to be enabled once the product bug is fixed
it("Validate the Button binding with Text Widget with Recaptcha Token with invalid key before using valid key", function () {
it.skip("Validate the Button binding with Text Widget with Recaptcha Token with invalid key before using valid key", function () {
cy.get("button")
.contains("Submit")
.should("be.visible")
@ -66,7 +66,7 @@ describe(
});
});
it.only("2. Validate the Button binding with Text Widget with Recaptcha Token with v2Key & upward compatibilty doesnt work", function () {
it("2. Validate the Button binding with Text Widget with Recaptcha Token with v2Key & upward compatibilty doesnt work", function () {
_.entityExplorer.SelectEntityByName("Button1");
_.propPane.UpdatePropertyFieldValue(
"Google reCAPTCHA key",
@ -89,7 +89,7 @@ describe(
_.agHelper.Sleep();
});
it.only("3. Validate the Button binding with Text Widget with Recaptcha Token with v3Key & v2key for backward compatible", function () {
it("3. Validate the Button binding with Text Widget with Recaptcha Token with v3Key & v2key for backward compatible", function () {
_.entityExplorer.SelectEntityByName("Button1");
_.propPane.UpdatePropertyFieldValue(
"Google reCAPTCHA key",
@ -122,7 +122,7 @@ describe(
});
//This test to be enabled once the product bug is fixed
it("Validate the Button binding with Text Widget with Recaptcha Token with invalid key", function () {
it.skip("Validate the Button binding with Text Widget with Recaptcha Token with invalid key", function () {
cy.get("button")
.contains("Submit")
.should("be.visible")

View File

@ -289,11 +289,12 @@
"cypress-xpath": "^1.6.0",
"diff": "^5.0.0",
"dotenv": "^8.1.0",
"eslint": "^8.36.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-babel-module": "^5.3.1",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^2.3.0",

View File

@ -225,6 +225,7 @@ describe("Canvas Hot Keys", () => {
expect(spyPaste).toHaveBeenCalled();
});
// eslint-disable-next-line jest/no-disabled-tests
it.skip("Cmd + A - select all widgets inside last selected container", async () => {
const containerId = generateReactKey();
const canvasId = generateReactKey();
@ -306,6 +307,7 @@ describe("Canvas Hot Keys", () => {
);
spyWidgetSelection.mockClear();
});
// eslint-disable-next-line jest/no-disabled-tests
it.skip("Cmd + A - select all widgets inside a form", async () => {
spyGetChildWidgets.mockImplementation(mockGetChildWidgets);
const children: any = buildChildren([
@ -354,6 +356,7 @@ describe("Canvas Hot Keys", () => {
const selectedWidgets = component.queryAllByTestId("t--selected");
expect(selectedWidgets.length).toBe(3);
});
// eslint-disable-next-line jest/no-disabled-tests
it.skip("Cmd + A - select all widgets inside a list", async () => {
const listId = generateReactKey();
const containerId = generateReactKey();

View File

@ -272,7 +272,7 @@ describe("isFunctionAsync", () => {
});
});
describe.only("convertAllDataTypesToString", () => {
describe("convertAllDataTypesToString", () => {
const cases = [
{ index: 0, input: 0, expected: "0" },
{ index: 1, input: -1, expected: "-1" },

View File

@ -76,6 +76,8 @@ describe("Tests for interval functions", () => {
// skipping this test as its flaky,
// check https://theappsmith.slack.com/archives/CPG2ZTXEY/p1681368791500909 for more details
// TODO https://github.com/appsmithorg/appsmith/issues/24177
// eslint-disable-next-line jest/no-disabled-tests
it.skip("Callback should have access to outer scope variables", async () => {
const stalker = jest.fn();
function test() {

View File

@ -2621,27 +2621,27 @@ __metadata:
languageName: node
linkType: hard
"@eslint/eslintrc@npm:^2.0.2":
version: 2.0.2
resolution: "@eslint/eslintrc@npm:2.0.2"
"@eslint/eslintrc@npm:^2.0.3":
version: 2.0.3
resolution: "@eslint/eslintrc@npm:2.0.3"
dependencies:
ajv: ^6.12.4
debug: ^4.3.2
espree: ^9.5.1
espree: ^9.5.2
globals: ^13.19.0
ignore: ^5.2.0
import-fresh: ^3.2.1
js-yaml: ^4.1.0
minimatch: ^3.1.2
strip-json-comments: ^3.1.1
checksum: cfcf5e12c7b2c4476482e7f12434e76eae16fcd163ee627309adb10b761e5caa4a4e52ed7be464423320ff3d11eca5b50de5bf8be3e25834222470835dd5c801
checksum: ddc51f25f8524d8231db9c9bf03177e503d941a332e8d5ce3b10b09241be4d5584a378a529a27a527586bfbccf3031ae539eb891352033c340b012b4d0c81d92
languageName: node
linkType: hard
"@eslint/js@npm:8.38.0":
version: 8.38.0
resolution: "@eslint/js@npm:8.38.0"
checksum: 1f28987aa8c9cd93e23384e16c7220863b39b5dc4b66e46d7cdbccce868040f455a98d24cd8b567a884f26545a0555b761f7328d4a00c051e7ef689cbea5fce1
"@eslint/js@npm:8.42.0":
version: 8.42.0
resolution: "@eslint/js@npm:8.42.0"
checksum: 750558843ac458f7da666122083ee05306fc087ecc1e5b21e7e14e23885775af6c55bcc92283dff1862b7b0d8863ec676c0f18c7faf1219c722fe91a8ece56b6
languageName: node
linkType: hard
@ -2994,14 +2994,14 @@ __metadata:
languageName: node
linkType: hard
"@humanwhocodes/config-array@npm:^0.11.8":
version: 0.11.8
resolution: "@humanwhocodes/config-array@npm:0.11.8"
"@humanwhocodes/config-array@npm:^0.11.10":
version: 0.11.10
resolution: "@humanwhocodes/config-array@npm:0.11.10"
dependencies:
"@humanwhocodes/object-schema": ^1.2.1
debug: ^4.1.1
minimatch: ^3.0.5
checksum: 0fd6b3c54f1674ce0a224df09b9c2f9846d20b9e54fabae1281ecfc04f2e6ad69bf19e1d6af6a28f88e8aa3990168b6cb9e1ef755868c3256a630605ec2cb1d3
checksum: 1b1302e2403d0e35bc43e66d67a2b36b0ad1119efc704b5faff68c41f791a052355b010fb2d27ef022670f550de24cd6d08d5ecf0821c16326b7dcd0ee5d5d8a
languageName: node
linkType: hard
@ -8394,6 +8394,16 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/scope-manager@npm:5.59.9":
version: 5.59.9
resolution: "@typescript-eslint/scope-manager@npm:5.59.9"
dependencies:
"@typescript-eslint/types": 5.59.9
"@typescript-eslint/visitor-keys": 5.59.9
checksum: 362c22662d844440a7e14223d8cc0722f77ff21ad8f78deb0ee3b3f21de01b8846bf25fbbf527544677e83d8ff48008b3f7d40b39ddec55994ea4a1863e9ec0a
languageName: node
linkType: hard
"@typescript-eslint/type-utils@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/type-utils@npm:5.58.0"
@ -8425,6 +8435,13 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/types@npm:5.59.9":
version: 5.59.9
resolution: "@typescript-eslint/types@npm:5.59.9"
checksum: 283f8fee1ee590eeccc2e0fcd3526c856c4b1e2841af2cdcd09eeac842a42cfb32f6bc8b40385380f3dbc3ee29da30f1819115eedf9e16f69ff5a160aeddd8fa
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:5.25.0":
version: 5.25.0
resolution: "@typescript-eslint/typescript-estree@npm:5.25.0"
@ -8461,6 +8478,24 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:5.59.9":
version: 5.59.9
resolution: "@typescript-eslint/typescript-estree@npm:5.59.9"
dependencies:
"@typescript-eslint/types": 5.59.9
"@typescript-eslint/visitor-keys": 5.59.9
debug: ^4.3.4
globby: ^11.1.0
is-glob: ^4.0.3
semver: ^7.3.7
tsutils: ^3.21.0
peerDependenciesMeta:
typescript:
optional: true
checksum: c0c9b81f20a2a4337f07bc3ccdc9c1dabd765f59096255ed9a149e91e5c9517b25c2b6655f8f073807cfc13500c7451fbd9bb62e5e572c07cc07945ab042db89
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:5.25.0":
version: 5.25.0
resolution: "@typescript-eslint/utils@npm:5.25.0"
@ -8477,7 +8512,7 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:5.58.0, @typescript-eslint/utils@npm:^5.13.0, @typescript-eslint/utils@npm:^5.45.0":
"@typescript-eslint/utils@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/utils@npm:5.58.0"
dependencies:
@ -8495,6 +8530,24 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:^5.10.0, @typescript-eslint/utils@npm:^5.13.0, @typescript-eslint/utils@npm:^5.45.0":
version: 5.59.9
resolution: "@typescript-eslint/utils@npm:5.59.9"
dependencies:
"@eslint-community/eslint-utils": ^4.2.0
"@types/json-schema": ^7.0.9
"@types/semver": ^7.3.12
"@typescript-eslint/scope-manager": 5.59.9
"@typescript-eslint/types": 5.59.9
"@typescript-eslint/typescript-estree": 5.59.9
eslint-scope: ^5.1.1
semver: ^7.3.7
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
checksum: 22ec5962886de7dcf65f99c37aad9fb189a3bef6b2b07c81887fb82a0e8bf137246da58e64fb02141352285708440be13acd7f6db1ca19e96f86724813ac4646
languageName: node
linkType: hard
"@typescript-eslint/visitor-keys@npm:5.25.0":
version: 5.25.0
resolution: "@typescript-eslint/visitor-keys@npm:5.25.0"
@ -8515,6 +8568,16 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/visitor-keys@npm:5.59.9":
version: 5.59.9
resolution: "@typescript-eslint/visitor-keys@npm:5.59.9"
dependencies:
"@typescript-eslint/types": 5.59.9
eslint-visitor-keys: ^3.3.0
checksum: 2909ce761f7fe546592cd3c43e33263d8a5fa619375fd2fdffbc72ffc33e40d6feacafb28c79f36c638fcc2225048e7cc08c61cbac6ca63723dc68610d80e3e6
languageName: node
linkType: hard
"@uppy/companion-client@npm:^1.8.1":
version: 1.8.1
resolution: "@uppy/companion-client@npm:1.8.1"
@ -9581,11 +9644,12 @@ __metadata:
diff: ^5.0.0
dotenv: ^8.1.0
downloadjs: ^1.4.7
eslint: ^8.36.0
eslint: ^8.42.0
eslint-config-prettier: ^8.6.0
eslint-import-resolver-babel-module: ^5.3.1
eslint-plugin-cypress: ^2.11.2
eslint-plugin-import: ^2.25.2
eslint-plugin-jest: ^27.2.1
eslint-plugin-prettier: ^4.2.1
eslint-plugin-react: ^7.30.0
eslint-plugin-react-hooks: ^2.3.0
@ -14769,6 +14833,23 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-jest@npm:^27.2.1":
version: 27.2.1
resolution: "eslint-plugin-jest@npm:27.2.1"
dependencies:
"@typescript-eslint/utils": ^5.10.0
peerDependencies:
"@typescript-eslint/eslint-plugin": ^5.0.0
eslint: ^7.0.0 || ^8.0.0
peerDependenciesMeta:
"@typescript-eslint/eslint-plugin":
optional: true
jest:
optional: true
checksum: 579a4d26304cc6748b2e6dff6c965ea7a21b618d8b051eb02727d25cf5c7767f6db8ef5237531635ff77e242b983b973e7cb8c820a4d20d5bda73358c452a8ab
languageName: node
linkType: hard
"eslint-plugin-jsx-a11y@npm:^6.5.1":
version: 6.5.1
resolution: "eslint-plugin-jsx-a11y@npm:6.5.1"
@ -14894,13 +14975,13 @@ __metadata:
languageName: node
linkType: hard
"eslint-scope@npm:^7.1.1":
version: 7.1.1
resolution: "eslint-scope@npm:7.1.1"
"eslint-scope@npm:^7.2.0":
version: 7.2.0
resolution: "eslint-scope@npm:7.2.0"
dependencies:
esrecurse: ^4.3.0
estraverse: ^5.2.0
checksum: 9f6e974ab2db641ca8ab13508c405b7b859e72afe9f254e8131ff154d2f40c99ad4545ce326fd9fde3212ff29707102562a4834f1c48617b35d98c71a97fbf3e
checksum: 64591a2d8b244ade9c690b59ef238a11d5c721a98bcee9e9f445454f442d03d3e04eda88e95a4daec558220a99fa384309d9faae3d459bd40e7a81b4063980ae
languageName: node
linkType: hard
@ -14922,10 +15003,10 @@ __metadata:
languageName: node
linkType: hard
"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.0":
version: 3.4.0
resolution: "eslint-visitor-keys@npm:3.4.0"
checksum: 33159169462d3989321a1ec1e9aaaf6a24cc403d5d347e9886d1b5bfe18ffa1be73bdc6203143a28a606b142b1af49787f33cff0d6d0813eb5f2e8d2e1a6043c
"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1":
version: 3.4.1
resolution: "eslint-visitor-keys@npm:3.4.1"
checksum: f05121d868202736b97de7d750847a328fcfa8593b031c95ea89425333db59676ac087fa905eba438d0a3c5769632f828187e0c1a0d271832a2153c1d3661c2c
languageName: node
linkType: hard
@ -14945,15 +15026,15 @@ __metadata:
languageName: node
linkType: hard
"eslint@npm:^8.3.0, eslint@npm:^8.36.0":
version: 8.38.0
resolution: "eslint@npm:8.38.0"
"eslint@npm:^8.3.0, eslint@npm:^8.42.0":
version: 8.42.0
resolution: "eslint@npm:8.42.0"
dependencies:
"@eslint-community/eslint-utils": ^4.2.0
"@eslint-community/regexpp": ^4.4.0
"@eslint/eslintrc": ^2.0.2
"@eslint/js": 8.38.0
"@humanwhocodes/config-array": ^0.11.8
"@eslint/eslintrc": ^2.0.3
"@eslint/js": 8.42.0
"@humanwhocodes/config-array": ^0.11.10
"@humanwhocodes/module-importer": ^1.0.1
"@nodelib/fs.walk": ^1.2.8
ajv: ^6.10.0
@ -14962,9 +15043,9 @@ __metadata:
debug: ^4.3.2
doctrine: ^3.0.0
escape-string-regexp: ^4.0.0
eslint-scope: ^7.1.1
eslint-visitor-keys: ^3.4.0
espree: ^9.5.1
eslint-scope: ^7.2.0
eslint-visitor-keys: ^3.4.1
espree: ^9.5.2
esquery: ^1.4.2
esutils: ^2.0.2
fast-deep-equal: ^3.1.3
@ -14972,13 +15053,12 @@ __metadata:
find-up: ^5.0.0
glob-parent: ^6.0.2
globals: ^13.19.0
grapheme-splitter: ^1.0.4
graphemer: ^1.4.0
ignore: ^5.2.0
import-fresh: ^3.0.0
imurmurhash: ^0.1.4
is-glob: ^4.0.0
is-path-inside: ^3.0.3
js-sdsl: ^4.1.4
js-yaml: ^4.1.0
json-stable-stringify-without-jsonify: ^1.0.1
levn: ^0.4.1
@ -14991,18 +15071,18 @@ __metadata:
text-table: ^0.2.0
bin:
eslint: bin/eslint.js
checksum: 73b6d9b650d0434aa7c07d0a1802f099b086ee70a8d8ba7be730439a26572a5eb71def12125c82942be2ec8ee5be38a6f1b42a13e40d4b67f11a148ec9e263eb
checksum: 07105397b5f2ff4064b983b8971e8c379ec04b1dfcc9d918976b3e00377189000161dac991d82ba14f8759e466091b8c71146f602930ca810c290ee3fcb3faf0
languageName: node
linkType: hard
"espree@npm:^9.5.1":
version: 9.5.1
resolution: "espree@npm:9.5.1"
"espree@npm:^9.5.2":
version: 9.5.2
resolution: "espree@npm:9.5.2"
dependencies:
acorn: ^8.8.0
acorn-jsx: ^5.3.2
eslint-visitor-keys: ^3.4.0
checksum: cdf6e43540433d917c4f2ee087c6e987b2063baa85a1d9cdaf51533d78275ebd5910c42154e7baf8e3e89804b386da0a2f7fad2264d8f04420e7506bf87b3b88
eslint-visitor-keys: ^3.4.1
checksum: 6506289d6eb26471c0b383ee24fee5c8ae9d61ad540be956b3127be5ce3bf687d2ba6538ee5a86769812c7c552a9d8239e8c4d150f9ea056c6d5cbe8399c03c1
languageName: node
linkType: hard
@ -16684,6 +16764,13 @@ __metadata:
languageName: node
linkType: hard
"graphemer@npm:^1.4.0":
version: 1.4.0
resolution: "graphemer@npm:1.4.0"
checksum: bab8f0be9b568857c7bec9fda95a89f87b783546d02951c40c33f84d05bb7da3fd10f863a9beb901463669b6583173a8c8cc6d6b306ea2b9b9d5d3d943c3a673
languageName: node
linkType: hard
"graphql-language-service@npm:^5.0.6":
version: 5.0.6
resolution: "graphql-language-service@npm:5.0.6"
@ -19893,13 +19980,6 @@ __metadata:
languageName: node
linkType: hard
"js-sdsl@npm:^4.1.4":
version: 4.3.0
resolution: "js-sdsl@npm:4.3.0"
checksum: ce908257cf6909e213af580af3a691a736f5ee8b16315454768f917a682a4ea0c11bde1b241bbfaecedc0eb67b72101b2c2df2ffaed32aed5d539fca816f054e
languageName: node
linkType: hard
"js-sha256@npm:^0.9.0":
version: 0.9.0
resolution: "js-sha256@npm:0.9.0"