From 204c59b80b8085c9007ad8abd6faeae3f984d1f3 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 18 Mar 2024 13:00:16 +0100 Subject: [PATCH 1/8] [TS migration] Migrate 'cherryPick.test.js' and 'authorChecklist.test.js' workflow tests --- package-lock.json | 1328 +++-------------- package.json | 3 +- tsconfig.json | 2 +- ...cklist.test.js => authorChecklist.test.ts} | 50 +- ...{cherryPick.test.js => cherryPick.test.ts} | 55 +- workflow_tests/jest.config.js | 2 +- 6 files changed, 262 insertions(+), 1178 deletions(-) rename workflow_tests/{authorChecklist.test.js => authorChecklist.test.ts} (79%) rename workflow_tests/{cherryPick.test.js => cherryPick.test.ts} (89%) diff --git a/package-lock.json b/package-lock.json index a84a72dd5167..f37509d05c4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -235,6 +235,7 @@ "shellcheck": "^1.1.0", "style-loader": "^2.0.0", "time-analytics-webpack-plugin": "^0.1.17", + "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "type-fest": "^4.10.2", "typescript": "^5.3.2", @@ -5411,28 +5412,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/console/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/console/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/@jest/console/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -5536,28 +5515,6 @@ } } }, - "node_modules/@jest/core/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/core/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/@jest/core/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -5626,86 +5583,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/create-cache-key-function/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/create-cache-key-function/node_modules/@types/yargs": { - "version": "17.0.31", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@jest/create-cache-key-function/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/create-cache-key-function/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/create-cache-key-function/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/create-cache-key-function/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/@jest/create-cache-key-function/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/create-cache-key-function/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/environment": { "version": "29.7.0", "license": "MIT", @@ -5719,86 +5596,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/environment/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/environment/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@jest/environment/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/environment/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/environment/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/environment/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/@jest/environment/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/environment/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/expect": { "version": "29.6.2", "license": "MIT", @@ -5835,86 +5632,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/fake-timers/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@jest/fake-timers/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/fake-timers/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/fake-timers/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/fake-timers/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/@jest/fake-timers/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/fake-timers/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/globals": { "version": "29.5.0", "license": "MIT", @@ -5928,86 +5645,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/globals/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/globals/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@jest/globals/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/globals/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/globals/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/globals/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/@jest/globals/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/globals/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/reporters": { "version": "29.4.1", "license": "MIT", @@ -6049,28 +5686,6 @@ } } }, - "node_modules/@jest/reporters/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/reporters/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/@jest/reporters/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -6190,86 +5805,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/test-result/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-result/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@jest/test-result/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/test-result/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/test-result/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/test-result/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/@jest/test-result/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/test-result/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/test-sequencer": { "version": "29.4.1", "license": "MIT", @@ -6307,28 +5842,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/transform/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/transform/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/@jest/transform/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -6403,17 +5916,19 @@ } }, "node_modules/@jest/types": { - "version": "26.6.2", - "license": "MIT", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "dependencies": { + "@jest/schemas": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^15.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": ">= 10.14.2" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/types/node_modules/ansi-styles": { @@ -8364,6 +7879,29 @@ "ws": "^7.5.1" } }, + "node_modules/@react-native-community/cli-server-api/node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@react-native-community/cli-server-api/node_modules/@types/yargs": { + "version": "15.0.19", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.19.tgz", + "integrity": "sha512-2XUaGVmyQjgyAZldf0D0c14vvo/yv0MhQBSTJcejMMaitsn3nxCB6TmH4G0ZQf+uxROOa9mpanoSm8h6SG/1ZA==", + "dependencies": { + "@types/yargs-parser": "*" + } + }, "node_modules/@react-native-community/cli-server-api/node_modules/ansi-regex": { "version": "5.0.1", "license": "MIT", @@ -8384,6 +7922,21 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/@react-native-community/cli-server-api/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@react-native-community/cli-server-api/node_modules/color-convert": { "version": "2.0.1", "license": "MIT", @@ -8398,6 +7951,14 @@ "version": "1.1.4", "license": "MIT" }, + "node_modules/@react-native-community/cli-server-api/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/@react-native-community/cli-server-api/node_modules/pretty-format": { "version": "26.6.2", "license": "MIT", @@ -8415,6 +7976,17 @@ "version": "17.0.2", "license": "MIT" }, + "node_modules/@react-native-community/cli-server-api/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@react-native-community/cli-server-api/node_modules/ws": { "version": "7.5.9", "license": "MIT", @@ -18840,15 +18412,17 @@ } }, "node_modules/@types/yargs": { - "version": "15.0.15", - "license": "MIT", + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "license": "MIT" + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" }, "node_modules/@types/yauzl": { "version": "2.10.0", @@ -22181,6 +21755,18 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/bser": { "version": "2.1.1", "license": "Apache-2.0", @@ -31380,28 +30966,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-circus/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-circus/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -31492,28 +31056,6 @@ } } }, - "node_modules/jest-cli/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-cli/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-cli/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -31615,28 +31157,6 @@ } } }, - "node_modules/jest-config/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-config/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-config/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -31790,28 +31310,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-each/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-each/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-each/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -31895,28 +31393,6 @@ } } }, - "node_modules/jest-environment-jsdom/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-environment-jsdom/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-environment-jsdom/node_modules/acorn": { "version": "8.11.3", "license": "MIT", @@ -31927,47 +31403,6 @@ "node": ">=0.4.0" } }, - "node_modules/jest-environment-jsdom/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-environment-jsdom/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-environment-jsdom/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-environment-jsdom/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, "node_modules/jest-environment-jsdom/node_modules/cssstyle": { "version": "2.3.0", "license": "MIT", @@ -32016,13 +31451,6 @@ "node": ">= 6" } }, - "node_modules/jest-environment-jsdom/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-environment-jsdom/node_modules/html-encoding-sniffer": { "version": "3.0.0", "license": "MIT", @@ -32086,16 +31514,6 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/jest-environment-jsdom/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-environment-jsdom/node_modules/tr46": { "version": "3.0.0", "license": "MIT", @@ -32166,86 +31584,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-environment-node/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-environment-node/node_modules/@types/yargs": { - "version": "17.0.31", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/jest-environment-node/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-environment-node/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-environment-node/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-environment-node/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/jest-environment-node/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-environment-node/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-expo": { "version": "50.0.1", "license": "MIT", @@ -32313,69 +31651,6 @@ "fsevents": "^2.3.2" } }, - "node_modules/jest-haste-map/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-haste-map/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/jest-haste-map/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-haste-map/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-haste-map/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-haste-map/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, "node_modules/jest-haste-map/node_modules/has-flag": { "version": "4.0.0", "license": "MIT", @@ -32409,16 +31684,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/jest-haste-map/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-leak-detector": { "version": "29.4.1", "license": "MIT", @@ -32519,28 +31784,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-message-util/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-message-util/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-message-util/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -32611,86 +31854,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-mock/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-mock/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/jest-mock/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-mock/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-mock/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-mock/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/jest-mock/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-mock/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-pnp-resolver": { "version": "1.2.3", "license": "MIT", @@ -32830,28 +31993,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runner/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runner/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-runner/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -32976,28 +32117,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runtime/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runtime/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-runtime/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -33085,28 +32204,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-snapshot/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-snapshot/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -33189,28 +32286,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-util/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-util/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-util/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -33284,28 +32359,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-validate/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-validate/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -33599,28 +32652,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-watcher/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-watcher/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, "node_modules/jest-watcher/node_modules/ansi-styles": { "version": "4.3.0", "license": "MIT", @@ -33718,86 +32749,6 @@ "node": ">=8" } }, - "node_modules/jest/node_modules/@jest/types": { - "version": "29.6.3", - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest/node_modules/@types/yargs": { - "version": "17.0.24", - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/jest/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest/node_modules/chalk": { - "version": "4.1.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/jest/node_modules/has-flag": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest/node_modules/supports-color": { - "version": "7.2.0", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/jimp-compact": { "version": "0.16.1", "license": "MIT" @@ -34455,6 +33406,12 @@ "license": "MIT", "peer": true }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, "node_modules/lodash.merge": { "version": "4.6.2", "dev": true, @@ -39536,6 +38493,29 @@ "node": ">=8" } }, + "node_modules/react-native/node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/react-native/node_modules/@types/yargs": { + "version": "15.0.19", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.19.tgz", + "integrity": "sha512-2XUaGVmyQjgyAZldf0D0c14vvo/yv0MhQBSTJcejMMaitsn3nxCB6TmH4G0ZQf+uxROOa9mpanoSm8h6SG/1ZA==", + "dependencies": { + "@types/yargs-parser": "*" + } + }, "node_modules/react-native/node_modules/ansi-regex": { "version": "5.0.1", "license": "MIT", @@ -39556,6 +38536,21 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/react-native/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/react-native/node_modules/color-convert": { "version": "2.0.1", "license": "MIT", @@ -39582,6 +38577,14 @@ "node": ">=18" } }, + "node_modules/react-native/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/react-native/node_modules/mkdirp": { "version": "0.5.6", "license": "MIT", @@ -39630,6 +38633,17 @@ "loose-envify": "^1.1.0" } }, + "node_modules/react-native/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/react-native/node_modules/ws": { "version": "6.2.2", "license": "MIT", @@ -43843,6 +42857,58 @@ "version": "0.1.13", "license": "Apache-2.0" }, + "node_modules/ts-jest": { + "version": "29.1.2", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", + "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", + "dev": true, + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/ts-node": { "version": "10.9.2", "devOptional": true, diff --git a/package.json b/package.json index e0f357fd0f8a..54d6b10caf95 100644 --- a/package.json +++ b/package.json @@ -157,8 +157,8 @@ "react-native-plaid-link-sdk": "10.8.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-release-profiler": "^0.1.6", "react-native-reanimated": "^3.7.2", + "react-native-release-profiler": "^0.1.6", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.8.2", "react-native-screens": "3.29.0", @@ -286,6 +286,7 @@ "shellcheck": "^1.1.0", "style-loader": "^2.0.0", "time-analytics-webpack-plugin": "^0.1.17", + "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "type-fest": "^4.10.2", "typescript": "^5.3.2", diff --git a/tsconfig.json b/tsconfig.json index 30708f63d12b..79413fdd2ca7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -48,6 +48,6 @@ } }, "exclude": ["**/node_modules/*", "**/dist/*", ".github/actions/**/index.js", "**/docs/*"], - "include": ["src", "desktop", "web", "website", "docs", "assets", "config", "tests", "jest", "__mocks__", ".github/**/*", ".storybook/**/*"], + "include": ["src", "desktop", "web", "website", "docs", "assets", "config", "tests", "jest", "__mocks__", ".github/**/*", ".storybook/**/*", "workflow_tests"], "extends": "expo/tsconfig.base" } diff --git a/workflow_tests/authorChecklist.test.js b/workflow_tests/authorChecklist.test.ts similarity index 79% rename from workflow_tests/authorChecklist.test.js rename to workflow_tests/authorChecklist.test.ts index 831e7f695ba4..0a6193198546 100644 --- a/workflow_tests/authorChecklist.test.js +++ b/workflow_tests/authorChecklist.test.ts @@ -1,13 +1,15 @@ -const path = require('path'); -const kieMockGithub = require('@kie/mock-github'); -const utils = require('./utils/utils'); -const assertions = require('./assertions/authorChecklistAssertions'); -const mocks = require('./mocks/authorChecklistMocks'); -const eAct = require('./utils/ExtendedAct'); +import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import * as kieMockGithub from '@kie/mock-github'; +import type {CreateRepositoryFile, MockGithub} from '@kie/mock-github'; +import path from 'path'; +import assertions from './assertions/authorChecklistAssertions'; +import mocks from './mocks/authorChecklistMocks'; +import eAct from './utils/ExtendedAct'; +import utils from './utils/utils'; jest.setTimeout(90 * 1000); -let mockGithub; -const FILES_TO_COPY_INTO_TEST_REPO = [ +let mockGithub: MockGithub; +const FILES_TO_COPY_INTO_TEST_REPO: CreateRepositoryFile[] = [ ...utils.deepCopy(utils.FILES_TO_COPY_INTO_TEST_REPO), { src: path.resolve(__dirname, '..', '.github', 'workflows', 'authorChecklist.yml'), @@ -18,7 +20,7 @@ const FILES_TO_COPY_INTO_TEST_REPO = [ describe('test workflow authorChecklist', () => { const githubToken = 'dummy_github_token'; - beforeAll(async () => { + beforeAll(() => { // in case of the tests being interrupted without cleanup the mock repo directory may be left behind // which breaks the next test run, this removes any possible leftovers utils.removeMockRepoDir(); @@ -47,11 +49,12 @@ describe('test workflow authorChecklist', () => { }; describe('actor is not OSBotify', () => { it('executes workflow', async () => { - const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); - const testMockSteps = { + const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, }; const result = await act.runEvent(event, { @@ -66,11 +69,12 @@ describe('test workflow authorChecklist', () => { }); describe('actor is OSBotify', () => { it('does not execute workflow', async () => { - const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); - const testMockSteps = { + const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, }; const result = await act.runEvent(event, { @@ -91,11 +95,12 @@ describe('test workflow authorChecklist', () => { }; describe('actor is not OSBotify', () => { it('executes workflow', async () => { - const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); - const testMockSteps = { + const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, }; const result = await act.runEvent(event, { @@ -110,11 +115,12 @@ describe('test workflow authorChecklist', () => { }); describe('actor is OSBotify', () => { it('does not execute workflow', async () => { - const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); - const testMockSteps = { + const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, }; const result = await act.runEvent(event, { @@ -135,11 +141,12 @@ describe('test workflow authorChecklist', () => { }; describe('actor is not OSBotify', () => { it('executes workflow', async () => { - const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); - const testMockSteps = { + const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, }; const result = await act.runEvent(event, { @@ -154,11 +161,12 @@ describe('test workflow authorChecklist', () => { }); describe('actor is OSBotify', () => { it('does not execute workflow', async () => { - const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); - const testMockSteps = { + const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, }; const result = await act.runEvent(event, { diff --git a/workflow_tests/cherryPick.test.js b/workflow_tests/cherryPick.test.ts similarity index 89% rename from workflow_tests/cherryPick.test.js rename to workflow_tests/cherryPick.test.ts index 592170a7c64e..8d9a1c76a0fc 100644 --- a/workflow_tests/cherryPick.test.js +++ b/workflow_tests/cherryPick.test.ts @@ -1,13 +1,15 @@ -const path = require('path'); -const kieMockGithub = require('@kie/mock-github'); -const utils = require('./utils/utils'); -const assertions = require('./assertions/cherryPickAssertions'); -const mocks = require('./mocks/cherryPickMocks'); -const eAct = require('./utils/ExtendedAct'); +import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import * as kieMockGithub from '@kie/mock-github'; +import type {CreateRepositoryFile, MockGithub} from '@kie/mock-github'; +import path from 'path'; +import assertions from './assertions/cherryPickAssertions'; +import mocks from './mocks/cherryPickMocks'; +import eAct from './utils/ExtendedAct'; +import utils from './utils/utils'; jest.setTimeout(90 * 1000); -let mockGithub; -const FILES_TO_COPY_INTO_TEST_REPO = [ +let mockGithub: MockGithub; +const FILES_TO_COPY_INTO_TEST_REPO: CreateRepositoryFile[] = [ ...utils.deepCopy(utils.FILES_TO_COPY_INTO_TEST_REPO), { src: path.resolve(__dirname, '..', '.github', 'workflows', 'cherryPick.yml'), @@ -16,7 +18,7 @@ const FILES_TO_COPY_INTO_TEST_REPO = [ ]; describe('test workflow cherryPick', () => { - beforeAll(async () => { + beforeAll(() => { // in case of the tests being interrupted without cleanup the mock repo directory may be left behind // which breaks the next test run, this removes any possible leftovers utils.removeMockRepoDir(); @@ -43,11 +45,12 @@ describe('test workflow cherryPick', () => { describe('actor is not deployer', () => { const actor = 'Dummy Author'; it('workflow ends after validate job', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -61,7 +64,7 @@ describe('test workflow cherryPick', () => { PULL_REQUEST_NUMBER: '1234', }, ); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, cherryPick: mocks.getCherryPickMockSteps(true, false), }; @@ -93,10 +96,10 @@ describe('test workflow cherryPick', () => { const mergeConflicts = false; const versionsMatch = true; it('behaviour is the same as with actor being the deployer', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, cherryPick: mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts), }; @@ -112,6 +115,7 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -145,10 +149,10 @@ describe('test workflow cherryPick', () => { describe('version match', () => { const versionsMatch = true; it('workflow executes, PR approved and merged automatically', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); @@ -164,6 +168,7 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -193,10 +198,10 @@ describe('test workflow cherryPick', () => { describe('version does not match', () => { const versionsMatch = false; it('workflow executes, PR auto-assigned and commented, approved and merged automatically', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); @@ -212,6 +217,7 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -244,10 +250,10 @@ describe('test workflow cherryPick', () => { describe('version match', () => { const versionsMatch = true; it('workflow executes, PR auto-assigned and commented, not merged automatically', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); @@ -263,6 +269,7 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -292,10 +299,10 @@ describe('test workflow cherryPick', () => { describe('version does not match', () => { const versionsMatch = false; it('workflow executes, PR auto-assigned and commented, not merged automatically', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); @@ -311,6 +318,7 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -343,11 +351,12 @@ describe('test workflow cherryPick', () => { describe('automatic trigger', () => { const event = 'pull_request'; it('workflow does not execute', async () => { - const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') || ''; + const repoPath = mockGithub.repo.getPath('testCherryPickWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'cherryPick.yml'); let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, + // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -361,7 +370,7 @@ describe('test workflow cherryPick', () => { PULL_REQUEST_NUMBER: '1234', }, ); - const testMockSteps = { + const testMockSteps: MockStep = { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, cherryPick: mocks.getCherryPickMockSteps(true, false), }; diff --git a/workflow_tests/jest.config.js b/workflow_tests/jest.config.js index c8a4534764e3..1fe7e5d82440 100644 --- a/workflow_tests/jest.config.js +++ b/workflow_tests/jest.config.js @@ -1,7 +1,7 @@ module.exports = { verbose: true, transform: { - '^.+\\.jsx?$': 'babel-jest', + '^.+\\.tsx?$': 'ts-jest', }, clearMocks: true, resetMocks: true, From a53bdcc9bce7128043b9f390047199f1e74cbe12 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 18 Mar 2024 15:34:17 +0100 Subject: [PATCH 2/8] Re-run performance check From 6aae16a54e7d9d489f7b4142199541ac5d6339fc Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 19 Mar 2024 09:51:41 +0100 Subject: [PATCH 3/8] Code improvements, jest config update --- workflow_tests/authorChecklist.test.ts | 2 ++ workflow_tests/cherryPick.test.ts | 2 ++ workflow_tests/jest.config.js | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/workflow_tests/authorChecklist.test.ts b/workflow_tests/authorChecklist.test.ts index 0a6193198546..399ddeec3ffc 100644 --- a/workflow_tests/authorChecklist.test.ts +++ b/workflow_tests/authorChecklist.test.ts @@ -8,7 +8,9 @@ import eAct from './utils/ExtendedAct'; import utils from './utils/utils'; jest.setTimeout(90 * 1000); + let mockGithub: MockGithub; + const FILES_TO_COPY_INTO_TEST_REPO: CreateRepositoryFile[] = [ ...utils.deepCopy(utils.FILES_TO_COPY_INTO_TEST_REPO), { diff --git a/workflow_tests/cherryPick.test.ts b/workflow_tests/cherryPick.test.ts index 8d9a1c76a0fc..d0ff4a269d99 100644 --- a/workflow_tests/cherryPick.test.ts +++ b/workflow_tests/cherryPick.test.ts @@ -8,7 +8,9 @@ import eAct from './utils/ExtendedAct'; import utils from './utils/utils'; jest.setTimeout(90 * 1000); + let mockGithub: MockGithub; + const FILES_TO_COPY_INTO_TEST_REPO: CreateRepositoryFile[] = [ ...utils.deepCopy(utils.FILES_TO_COPY_INTO_TEST_REPO), { diff --git a/workflow_tests/jest.config.js b/workflow_tests/jest.config.js index 1fe7e5d82440..73780de981fc 100644 --- a/workflow_tests/jest.config.js +++ b/workflow_tests/jest.config.js @@ -1,7 +1,7 @@ module.exports = { verbose: true, transform: { - '^.+\\.tsx?$': 'ts-jest', + '^.+\\.(js|jsx|ts|tsx)$': ['ts-jest', {babelConfig: true}], }, clearMocks: true, resetMocks: true, From 16ff03c6d324e3dc934da0660856ef2cc32e0fe6 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 19 Mar 2024 16:12:45 +0100 Subject: [PATCH 4/8] Simplify jest config for future updates --- workflow_tests/jest.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflow_tests/jest.config.js b/workflow_tests/jest.config.js index 73780de981fc..cecdf8589d7f 100644 --- a/workflow_tests/jest.config.js +++ b/workflow_tests/jest.config.js @@ -1,7 +1,8 @@ module.exports = { verbose: true, transform: { - '^.+\\.(js|jsx|ts|tsx)$': ['ts-jest', {babelConfig: true}], + '^.+\\.jsx?$': 'babel-jest', + '^.+\\.tsx?$': 'ts-jest', }, clearMocks: true, resetMocks: true, From ee2ba9ef9214831540436814414382f8a3c522c7 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 25 Mar 2024 12:41:22 +0100 Subject: [PATCH 5/8] Resolve TS issues --- workflow_tests/authorChecklist.test.ts | 8 +--- workflow_tests/cherryPick.test.ts | 24 +++++------- workflow_tests/mocks/authorChecklistMocks.ts | 2 +- workflow_tests/mocks/cherryPickMocks.ts | 38 +++++++++--------- workflow_tests/utils/JobMocker.ts | 41 +++++++++++--------- workflow_tests/utils/preGenerateTest.ts | 10 ++--- 6 files changed, 57 insertions(+), 66 deletions(-) diff --git a/workflow_tests/authorChecklist.test.ts b/workflow_tests/authorChecklist.test.ts index d55fe6611bce..1286f0c6c246 100644 --- a/workflow_tests/authorChecklist.test.ts +++ b/workflow_tests/authorChecklist.test.ts @@ -3,7 +3,7 @@ import * as kieMockGithub from '@kie/mock-github'; import type {CreateRepositoryFile, MockGithub} from '@kie/mock-github'; import path from 'path'; import assertions from './assertions/authorChecklistAssertions'; -import mocks from './mocks/authorChecklistMocks'; +import * as mocks from './mocks/authorChecklistMocks'; import ExtendedAct from './utils/ExtendedAct'; import * as utils from './utils/utils'; @@ -54,7 +54,6 @@ describe('test workflow authorChecklist', () => { const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new ExtendedAct(repoPath, workflowPath); - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, @@ -74,7 +73,6 @@ describe('test workflow authorChecklist', () => { const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new ExtendedAct(repoPath, workflowPath); - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, @@ -100,7 +98,6 @@ describe('test workflow authorChecklist', () => { const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new ExtendedAct(repoPath, workflowPath); - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, @@ -120,7 +117,6 @@ describe('test workflow authorChecklist', () => { const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new ExtendedAct(repoPath, workflowPath); - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, @@ -146,7 +142,6 @@ describe('test workflow authorChecklist', () => { const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new ExtendedAct(repoPath, workflowPath); - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, @@ -166,7 +161,6 @@ describe('test workflow authorChecklist', () => { const repoPath = mockGithub.repo.getPath('testAuthorChecklistWorkflowRepo') ?? ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'authorChecklist.yml'); let act = new ExtendedAct(repoPath, workflowPath); - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. act = utils.setUpActParams(act, event, eventOptions, {}, githubToken); const testMockSteps: MockStep = { checklist: mocks.AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS, diff --git a/workflow_tests/cherryPick.test.ts b/workflow_tests/cherryPick.test.ts index 4c68d0bca24b..e8606e6d6323 100644 --- a/workflow_tests/cherryPick.test.ts +++ b/workflow_tests/cherryPick.test.ts @@ -3,8 +3,9 @@ import * as kieMockGithub from '@kie/mock-github'; import type {CreateRepositoryFile, MockGithub} from '@kie/mock-github'; import path from 'path'; import assertions from './assertions/cherryPickAssertions'; -import mocks from './mocks/cherryPickMocks'; +import * as mocks from './mocks/cherryPickMocks'; import ExtendedAct from './utils/ExtendedAct'; +import type {MockJobs} from './utils/JobMocker'; import * as utils from './utils/utils'; jest.setTimeout(90 * 1000); @@ -52,7 +53,6 @@ describe('test workflow cherryPick', () => { let act = new ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -70,7 +70,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, cherryPick: mocks.getCherryPickMockSteps(true, false), }; - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { @@ -105,7 +105,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, cherryPick: mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts), }; - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { @@ -117,7 +117,6 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -158,7 +157,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { @@ -170,7 +169,6 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -207,7 +205,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { @@ -219,7 +217,6 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -259,7 +256,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { @@ -271,7 +268,6 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -308,7 +304,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, }; testMockSteps.cherryPick = mocks.getCherryPickMockSteps(versionsMatch, mergeConflicts); - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { @@ -320,7 +316,6 @@ describe('test workflow cherryPick', () => { }; act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -358,7 +353,6 @@ describe('test workflow cherryPick', () => { let act = new ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, - // @ts-expect-error TODO: Remove this once utils (https://github.com/Expensify/App/issues/32061) is migrated to TypeScript. event, null, { @@ -376,7 +370,7 @@ describe('test workflow cherryPick', () => { validateActor: mocks.CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, cherryPick: mocks.getCherryPickMockSteps(true, false), }; - const testMockJobs = { + const testMockJobs: MockJobs = { createNewVersion: { steps: mocks.CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, outputs: { diff --git a/workflow_tests/mocks/authorChecklistMocks.ts b/workflow_tests/mocks/authorChecklistMocks.ts index b4d520eb7a1f..ff8abc00f798 100644 --- a/workflow_tests/mocks/authorChecklistMocks.ts +++ b/workflow_tests/mocks/authorChecklistMocks.ts @@ -4,7 +4,7 @@ import {createMockStep} from '../utils/utils'; // checklist const AUTHORCHECKLIST__CHECKLIST__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'CHECKLIST'); const AUTHORCHECKLIST__CHECKLIST__AUTHORCHECKLIST_JS__STEP_MOCK = createMockStep('authorChecklist.js', 'Running authorChecklist.js', 'CHECKLIST', ['GITHUB_TOKEN'], []); -const AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS = [AUTHORCHECKLIST__CHECKLIST__CHECKOUT__STEP_MOCK, AUTHORCHECKLIST__CHECKLIST__AUTHORCHECKLIST_JS__STEP_MOCK] as const; +const AUTHORCHECKLIST__CHECKLIST__STEP_MOCKS = [AUTHORCHECKLIST__CHECKLIST__CHECKOUT__STEP_MOCK, AUTHORCHECKLIST__CHECKLIST__AUTHORCHECKLIST_JS__STEP_MOCK]; export { // eslint-disable-next-line import/prefer-default-export diff --git a/workflow_tests/mocks/cherryPickMocks.ts b/workflow_tests/mocks/cherryPickMocks.ts index f1508a3dc39d..7dc77b1b5a97 100644 --- a/workflow_tests/mocks/cherryPickMocks.ts +++ b/workflow_tests/mocks/cherryPickMocks.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import {createMockStep} from '../utils/utils'; // validateactor @@ -18,8 +19,8 @@ const CHERRYPICK__VALIDATEACTOR__CHECK_IF_USER_IS_DEPLOYER_FALSE__STEP_MOCK = cr ['GITHUB_TOKEN'], {IS_DEPLOYER: false}, ); -const CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS = [CHERRYPICK__VALIDATEACTOR__CHECK_IF_USER_IS_DEPLOYER_TRUE__STEP_MOCK] as const; -const CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS = [CHERRYPICK__VALIDATEACTOR__CHECK_IF_USER_IS_DEPLOYER_FALSE__STEP_MOCK] as const; +const CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS = [CHERRYPICK__VALIDATEACTOR__CHECK_IF_USER_IS_DEPLOYER_TRUE__STEP_MOCK]; +const CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS = [CHERRYPICK__VALIDATEACTOR__CHECK_IF_USER_IS_DEPLOYER_FALSE__STEP_MOCK]; // createnewversion const CHERRYPICK__CREATENEWVERSION__CREATE_NEW_VERSION__STEP_MOCK = createMockStep( @@ -33,7 +34,7 @@ const CHERRYPICK__CREATENEWVERSION__CREATE_NEW_VERSION__STEP_MOCK = createMockSt true, 'createNewVersion', ); -const CHERRYPICK__CREATENEWVERSION__STEP_MOCKS = [CHERRYPICK__CREATENEWVERSION__CREATE_NEW_VERSION__STEP_MOCK] as const; +const CHERRYPICK__CREATENEWVERSION__STEP_MOCKS = [CHERRYPICK__CREATENEWVERSION__CREATE_NEW_VERSION__STEP_MOCK]; // cherrypick const CHERRYPICK__CHERRYPICK__CHECKOUT_STAGING_BRANCH__STEP_MOCK = createMockStep('Checkout staging branch', 'Checking out staging branch', 'CHERRYPICK', ['ref', 'token'], []); @@ -93,21 +94,20 @@ const CHERRYPICK__CHERRYPICK__ANNOUNCES_A_CP_FAILURE_IN_THE_ANNOUNCE_SLACK_ROOM_ ['GITHUB_TOKEN', 'SLACK_WEBHOOK_URL'], ); -const getCherryPickMockSteps = (upToDate: boolean, hasConflicts: boolean) => - [ - CHERRYPICK__CHERRYPICK__CHECKOUT_STAGING_BRANCH__STEP_MOCK, - CHERRYPICK__CHERRYPICK__SET_UP_GIT_FOR_OSBOTIFY__STEP_MOCK, - CHERRYPICK__CHERRYPICK__GET_PREVIOUS_APP_VERSION__STEP_MOCK, - CHERRYPICK__CHERRYPICK__FETCH_HISTORY_OF_RELEVANT_REFS__STEP_MOCK, - CHERRYPICK__CHERRYPICK__GET_VERSION_BUMP_COMMIT__STEP_MOCK, - CHERRYPICK__CHERRYPICK__GET_MERGE_COMMIT_FOR_PULL_REQUEST_TO_CP__STEP_MOCK, - CHERRYPICK__CHERRYPICK__CHERRY_PICK_THE_VERSION_BUMP_TO_STAGING__STEP_MOCK, - hasConflicts - ? CHERRYPICK__CHERRYPICK__CHERRY_PICK_THE_MERGE_COMMIT_OF_TARGET_PR_TO_NEW_BRANCH__HAS_CONFLICTS__STEP_MOCK - : CHERRYPICK__CHERRYPICK__CHERRY_PICK_THE_MERGE_COMMIT_OF_TARGET_PR_TO_NEW_BRANCH__HAS_NO_CONFLICTS__STEP_MOCK, - CHERRYPICK__CHERRYPICK__PUSH_CHANGES__STEP_MOCK, - CHERRYPICK__CHERRYPICK__CREATE_PULL_REQUEST_TO_MANUALLY_FINISH_CP__STEP_MOCK, - CHERRYPICK__CHERRYPICK__ANNOUNCES_A_CP_FAILURE_IN_THE_ANNOUNCE_SLACK_ROOM__STEP_MOCK, - ] as const; +const getCherryPickMockSteps = (upToDate: boolean, hasConflicts: boolean): StepIdentifier[] => [ + CHERRYPICK__CHERRYPICK__CHECKOUT_STAGING_BRANCH__STEP_MOCK, + CHERRYPICK__CHERRYPICK__SET_UP_GIT_FOR_OSBOTIFY__STEP_MOCK, + CHERRYPICK__CHERRYPICK__GET_PREVIOUS_APP_VERSION__STEP_MOCK, + CHERRYPICK__CHERRYPICK__FETCH_HISTORY_OF_RELEVANT_REFS__STEP_MOCK, + CHERRYPICK__CHERRYPICK__GET_VERSION_BUMP_COMMIT__STEP_MOCK, + CHERRYPICK__CHERRYPICK__GET_MERGE_COMMIT_FOR_PULL_REQUEST_TO_CP__STEP_MOCK, + CHERRYPICK__CHERRYPICK__CHERRY_PICK_THE_VERSION_BUMP_TO_STAGING__STEP_MOCK, + hasConflicts + ? CHERRYPICK__CHERRYPICK__CHERRY_PICK_THE_MERGE_COMMIT_OF_TARGET_PR_TO_NEW_BRANCH__HAS_CONFLICTS__STEP_MOCK + : CHERRYPICK__CHERRYPICK__CHERRY_PICK_THE_MERGE_COMMIT_OF_TARGET_PR_TO_NEW_BRANCH__HAS_NO_CONFLICTS__STEP_MOCK, + CHERRYPICK__CHERRYPICK__PUSH_CHANGES__STEP_MOCK, + CHERRYPICK__CHERRYPICK__CREATE_PULL_REQUEST_TO_MANUALLY_FINISH_CP__STEP_MOCK, + CHERRYPICK__CHERRYPICK__ANNOUNCES_A_CP_FAILURE_IN_THE_ANNOUNCE_SLACK_ROOM__STEP_MOCK, +]; export {CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, getCherryPickMockSteps}; diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index b6dc99771dd2..41787a72226d 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,36 +1,39 @@ +import type {GithubWorkflowStep, StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; -// eslint-disable-next-line @typescript-eslint/naming-convention -type YamlMockJob = Omit & {'runs-on'?: string}; +type YamlStepIdentifier = Partial & { + name: string; + id?: string; + inputs?: string[]; + envs?: string[]; + run?: GithubWorkflowStep | string; + with?: string; +}; + +type YamlMockJob = Omit & { + steps: YamlStepIdentifier[]; + // eslint-disable-next-line @typescript-eslint/naming-convention + 'runs-on'?: string; +}; type YamlWorkflow = { jobs: Record; }; type MockJob = { - steps: MockJobStep[]; + steps: StepIdentifier[]; uses?: string; secrets?: string[]; with?: string; - outputs?: string[]; + outputs?: Record; runsOn?: string; }; type MockJobs = Record; -type MockJobStep = { - id?: string; - name: string; - run?: string; - mockWith?: string; - with?: string; - envs?: string[]; - inputs?: string[]; -}; - class JobMocker { workflowFile: string; @@ -59,12 +62,12 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step) => { - const mockStep: MockJobStep = { - name: step.name, + job.steps = mockJob.steps.map((step: StepIdentifier) => { + const mockStep: YamlStepIdentifier = { + name: 'name' in step ? step.name : '', run: step.mockWith, }; - if (step.id) { + if ('id' in step && step.id) { mockStep.id = step.id; } if (jobWith) { @@ -114,4 +117,4 @@ class JobMocker { } export default JobMocker; -export type {MockJob, MockJobs, YamlWorkflow, YamlMockJob, MockJobStep}; +export type {MockJob, MockJobs, YamlWorkflow, YamlMockJob, YamlStepIdentifier}; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index 7698e618432d..6b0ed0f155c4 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import {exit} from 'process'; import yaml from 'yaml'; -import type {MockJobStep, YamlMockJob, YamlWorkflow} from './JobMocker'; +import type {YamlMockJob, YamlStepIdentifier, YamlWorkflow} from './JobMocker'; const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows'); const workflowTestsDirectory = path.resolve(__dirname, '..'); @@ -97,7 +97,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: MockJobStep, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: YamlStepIdentifier, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -203,10 +203,10 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { steps: [], }; job.steps.forEach((step) => { - const workflowStep = { + const workflowStep: YamlStepIdentifier = { name: step.name, - inputs: Object.keys(step.with ?? {}), - envs: step.envs ?? [], + inputs: 'with' in step && step.with ? Object.keys(step.with) : [], + envs: 'envs' in step && step.envs ? step.envs : [], }; workflowJobs[jobId].steps.push(workflowStep); }); From b81c9bc2fc8204f00fb70515292c2fcd4868bf4b Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 25 Mar 2024 12:49:04 +0100 Subject: [PATCH 6/8] Code improvements --- workflow_tests/utils/JobMocker.ts | 2 +- workflow_tests/utils/preGenerateTest.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index 41787a72226d..592e2a758636 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -62,7 +62,7 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step: StepIdentifier) => { + job.steps = mockJob.steps.map((step) => { const mockStep: YamlStepIdentifier = { name: 'name' in step ? step.name : '', run: step.mockWith, diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index 6b0ed0f155c4..bc4867a83827 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -205,8 +205,8 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { job.steps.forEach((step) => { const workflowStep: YamlStepIdentifier = { name: step.name, - inputs: 'with' in step && step.with ? Object.keys(step.with) : [], - envs: 'envs' in step && step.envs ? step.envs : [], + inputs: Object.keys(step.with ?? {}), + envs: step.envs ?? [], }; workflowJobs[jobId].steps.push(workflowStep); }); From 7b8d0a2bcfa8555c16a028e5ff745e6e03bf451b Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 25 Mar 2024 12:53:59 +0100 Subject: [PATCH 7/8] Fix TS issue --- workflow_tests/failureNotifier.test.ts | 2 +- workflow_tests/mocks/failureNotifierMocks.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/workflow_tests/failureNotifier.test.ts b/workflow_tests/failureNotifier.test.ts index 8dfc092c7e61..d25378f8500e 100644 --- a/workflow_tests/failureNotifier.test.ts +++ b/workflow_tests/failureNotifier.test.ts @@ -3,7 +3,7 @@ import type {CreateRepositoryFile} from '@kie/mock-github'; import {MockGithub} from '@kie/mock-github'; import path from 'path'; import assertions from './assertions/failureNotifierAssertions'; -import mocks from './mocks/failureNotifierMocks'; +import * as mocks from './mocks/failureNotifierMocks'; import ExtendedAct from './utils/ExtendedAct'; jest.setTimeout(90 * 1000); diff --git a/workflow_tests/mocks/failureNotifierMocks.ts b/workflow_tests/mocks/failureNotifierMocks.ts index 5c869adae21b..0758d4bf7a70 100644 --- a/workflow_tests/mocks/failureNotifierMocks.ts +++ b/workflow_tests/mocks/failureNotifierMocks.ts @@ -6,10 +6,7 @@ import {createMockStep} from '../utils/utils'; // notifyfailure const FAILURENOTIFIER__NOTIFYFAILURE__FETCH_WORKFLOW_RUN_JOBS__STEP_MOCK = createMockStep('Fetch Workflow Run Jobs', 'Fetch Workflow Run Jobs', 'NOTIFYFAILURE', [], []); const FAILURENOTIFIER__NOTIFYFAILURE__PROCESS_EACH_FAILED_JOB__STEP_MOCK = createMockStep('Process Each Failed Job', 'Process Each Failed Job', 'NOTIFYFAILURE', [], []); -const FAILURENOTIFIER__NOTIFYFAILURE__STEP_MOCKS = [ - FAILURENOTIFIER__NOTIFYFAILURE__FETCH_WORKFLOW_RUN_JOBS__STEP_MOCK, - FAILURENOTIFIER__NOTIFYFAILURE__PROCESS_EACH_FAILED_JOB__STEP_MOCK, -] as const; +const FAILURENOTIFIER__NOTIFYFAILURE__STEP_MOCKS = [FAILURENOTIFIER__NOTIFYFAILURE__FETCH_WORKFLOW_RUN_JOBS__STEP_MOCK, FAILURENOTIFIER__NOTIFYFAILURE__PROCESS_EACH_FAILED_JOB__STEP_MOCK]; export { // eslint-disable-next-line import/prefer-default-export From dcc53e83c902a0f72657ddaef90ad392918a4af2 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 25 Mar 2024 18:32:58 +0100 Subject: [PATCH 8/8] TS fixes after merging main, remove extra updates --- package.json | 2 +- src/types/modules/act.d.ts | 14 ++++++++++++ workflow_tests/authorChecklist.test.ts | 2 +- workflow_tests/cherryPick.test.ts | 2 +- workflow_tests/failureNotifier.test.ts | 2 +- workflow_tests/mocks/cherryPickMocks.ts | 2 +- workflow_tests/utils/JobMocker.ts | 30 ++++++++----------------- workflow_tests/utils/preGenerateTest.ts | 7 +++--- 8 files changed, 32 insertions(+), 29 deletions(-) create mode 100644 src/types/modules/act.d.ts diff --git a/package.json b/package.json index 0239b2a21635..c41afac9d570 100644 --- a/package.json +++ b/package.json @@ -154,8 +154,8 @@ "react-native-plaid-link-sdk": "10.8.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "^3.7.2", "react-native-release-profiler": "^0.1.6", + "react-native-reanimated": "^3.7.2", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.8.2", "react-native-screens": "3.29.0", diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts new file mode 100644 index 000000000000..5fe00ec479cf --- /dev/null +++ b/src/types/modules/act.d.ts @@ -0,0 +1,14 @@ +import type {StepIdentifier as ActStepIdentifier} from '@kie/act-js'; + +declare module '@kie/act-js' { + // eslint-disable-next-line rulesdir/no-inline-named-export + export declare type StepIdentifier = { + id?: string; + name: string; + run?: string; + mockWith?: string; + with?: string; + envs?: string[]; + inputs?: string[]; + } & Omit; +} diff --git a/workflow_tests/authorChecklist.test.ts b/workflow_tests/authorChecklist.test.ts index 1286f0c6c246..c0b1c7cf7533 100644 --- a/workflow_tests/authorChecklist.test.ts +++ b/workflow_tests/authorChecklist.test.ts @@ -3,7 +3,7 @@ import * as kieMockGithub from '@kie/mock-github'; import type {CreateRepositoryFile, MockGithub} from '@kie/mock-github'; import path from 'path'; import assertions from './assertions/authorChecklistAssertions'; -import * as mocks from './mocks/authorChecklistMocks'; +import mocks from './mocks/authorChecklistMocks'; import ExtendedAct from './utils/ExtendedAct'; import * as utils from './utils/utils'; diff --git a/workflow_tests/cherryPick.test.ts b/workflow_tests/cherryPick.test.ts index e8606e6d6323..47a1c489df70 100644 --- a/workflow_tests/cherryPick.test.ts +++ b/workflow_tests/cherryPick.test.ts @@ -3,7 +3,7 @@ import * as kieMockGithub from '@kie/mock-github'; import type {CreateRepositoryFile, MockGithub} from '@kie/mock-github'; import path from 'path'; import assertions from './assertions/cherryPickAssertions'; -import * as mocks from './mocks/cherryPickMocks'; +import mocks from './mocks/cherryPickMocks'; import ExtendedAct from './utils/ExtendedAct'; import type {MockJobs} from './utils/JobMocker'; import * as utils from './utils/utils'; diff --git a/workflow_tests/failureNotifier.test.ts b/workflow_tests/failureNotifier.test.ts index d25378f8500e..8dfc092c7e61 100644 --- a/workflow_tests/failureNotifier.test.ts +++ b/workflow_tests/failureNotifier.test.ts @@ -3,7 +3,7 @@ import type {CreateRepositoryFile} from '@kie/mock-github'; import {MockGithub} from '@kie/mock-github'; import path from 'path'; import assertions from './assertions/failureNotifierAssertions'; -import * as mocks from './mocks/failureNotifierMocks'; +import mocks from './mocks/failureNotifierMocks'; import ExtendedAct from './utils/ExtendedAct'; jest.setTimeout(90 * 1000); diff --git a/workflow_tests/mocks/cherryPickMocks.ts b/workflow_tests/mocks/cherryPickMocks.ts index e7762731c066..c1a33be868d6 100644 --- a/workflow_tests/mocks/cherryPickMocks.ts +++ b/workflow_tests/mocks/cherryPickMocks.ts @@ -110,4 +110,4 @@ const getCherryPickMockSteps = (upToDate: boolean, hasConflicts: boolean): StepI CHERRYPICK__CHERRYPICK__ANNOUNCES_A_CP_FAILURE_IN_THE_ANNOUNCE_SLACK_ROOM__STEP_MOCK, ]; -export {CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, getCherryPickMockSteps}; +export default {CHERRYPICK__CREATENEWVERSION__STEP_MOCKS, CHERRYPICK__VALIDATEACTOR__FALSE__STEP_MOCKS, CHERRYPICK__VALIDATEACTOR__TRUE__STEP_MOCKS, getCherryPickMockSteps}; diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index 592e2a758636..dadb85014d01 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,23 +1,11 @@ -import type {GithubWorkflowStep, StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; -type YamlStepIdentifier = Partial & { - name: string; - id?: string; - inputs?: string[]; - envs?: string[]; - run?: GithubWorkflowStep | string; - with?: string; -}; - -type YamlMockJob = Omit & { - steps: YamlStepIdentifier[]; - // eslint-disable-next-line @typescript-eslint/naming-convention - 'runs-on'?: string; -}; +// eslint-disable-next-line @typescript-eslint/naming-convention +type YamlMockJob = Omit & {'runs-on'?: string}; type YamlWorkflow = { jobs: Record; @@ -29,7 +17,7 @@ type MockJob = { secrets?: string[]; with?: string; outputs?: Record; - runsOn?: string; + runsOn: string; }; type MockJobs = Record; @@ -62,12 +50,12 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step) => { - const mockStep: YamlStepIdentifier = { - name: 'name' in step ? step.name : '', + job.steps = mockJob.steps.map((step): StepIdentifier => { + const mockStep: StepIdentifier = { + name: step.name, run: step.mockWith, }; - if ('id' in step && step.id) { + if (step.id) { mockStep.id = step.id; } if (jobWith) { @@ -117,4 +105,4 @@ class JobMocker { } export default JobMocker; -export type {MockJob, MockJobs, YamlWorkflow, YamlMockJob, YamlStepIdentifier}; +export type {MockJob, MockJobs, YamlWorkflow, YamlMockJob}; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index bc4867a83827..c5e54d9a11c0 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,10 +1,11 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ +import type {StepIdentifier} from '@kie/act-js'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; import {exit} from 'process'; import yaml from 'yaml'; -import type {YamlMockJob, YamlStepIdentifier, YamlWorkflow} from './JobMocker'; +import type {YamlMockJob, YamlWorkflow} from './JobMocker'; const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows'); const workflowTestsDirectory = path.resolve(__dirname, '..'); @@ -97,7 +98,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: YamlStepIdentifier, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: StepIdentifier, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -203,7 +204,7 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { steps: [], }; job.steps.forEach((step) => { - const workflowStep: YamlStepIdentifier = { + const workflowStep = { name: step.name, inputs: Object.keys(step.with ?? {}), envs: step.envs ?? [],