From 869eef72113c4a79e7d7befc9292abdafaca72c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Fri, 25 Aug 2023 14:38:09 +0200 Subject: [PATCH 1/3] install eslint-plugin-jest-extended dev dependency --- package-lock.json | 27 ++++++++++++++++++++++++++- package.json | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index f3ade4a57d..bb9ef19097 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "bpmn-visualization", - "version": "0.38.1", + "version": "0.38.1-post", "license": "Apache-2.0", "dependencies": { "@typed-mxgraph/typed-mxgraph": "~1.0.8", @@ -35,6 +35,7 @@ "eslint": "~8.47.0", "eslint-config-prettier": "~9.0.0", "eslint-plugin-jest": "~27.2.3", + "eslint-plugin-jest-extended": "^2.0.0", "eslint-plugin-notice": "~0.9.10", "eslint-plugin-playwright": "~0.15.3", "eslint-plugin-prettier": "~5.0.0", @@ -5881,6 +5882,21 @@ } } }, + "node_modules/eslint-plugin-jest-extended": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest-extended/-/eslint-plugin-jest-extended-2.0.0.tgz", + "integrity": "sha512-nMhVVsVcG/+Q6FMshql35WBxwx8xlBhxKgAG08WP3BYWfXrp28oxLpJVu9JSbMpfmfKGVrHwMYJGfPLRKlGB8w==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "^5.10.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, "node_modules/eslint-plugin-notice": { "version": "0.9.10", "dev": true, @@ -17174,6 +17190,15 @@ "@typescript-eslint/utils": "^5.10.0" } }, + "eslint-plugin-jest-extended": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest-extended/-/eslint-plugin-jest-extended-2.0.0.tgz", + "integrity": "sha512-nMhVVsVcG/+Q6FMshql35WBxwx8xlBhxKgAG08WP3BYWfXrp28oxLpJVu9JSbMpfmfKGVrHwMYJGfPLRKlGB8w==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "^5.10.0" + } + }, "eslint-plugin-notice": { "version": "0.9.10", "dev": true, diff --git a/package.json b/package.json index 044158a877..0c135c93d9 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "eslint": "~8.47.0", "eslint-config-prettier": "~9.0.0", "eslint-plugin-jest": "~27.2.3", + "eslint-plugin-jest-extended": "^2.0.0", "eslint-plugin-notice": "~0.9.10", "eslint-plugin-playwright": "~0.15.3", "eslint-plugin-prettier": "~5.0.0", From 9b92550e0f41a4d1f0c4f4d7d3b5716170b2e7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Fri, 25 Aug 2023 14:42:06 +0200 Subject: [PATCH 2/3] configure ESLint for tests --- test/.eslintrc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/.eslintrc.js b/test/.eslintrc.js index a8ff31185a..0ad4ee44ad 100644 --- a/test/.eslintrc.js +++ b/test/.eslintrc.js @@ -15,7 +15,7 @@ limitations under the License. */ module.exports = { - plugins: ['jest'], + plugins: ['jest', 'jest-extended'], env: { 'jest/globals': true, }, @@ -24,7 +24,7 @@ module.exports = { version: require('jest/package.json').version, }, }, - extends: ['plugin:jest/recommended', 'plugin:jest/style'], + extends: ['plugin:jest/recommended', 'plugin:jest/style', 'plugin:jest-extended/all'], rules: { /* The rule list: https://github.com/jest-community/eslint-plugin-jest#rules */ 'jest/prefer-expect-resolves': 'warn', From a4fb8b5870a83c0a826a6aa0a96d32ecccf481d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= Date: Fri, 25 Aug 2023 14:42:44 +0200 Subject: [PATCH 3/3] fix lint --- test/performance/bpmn.load.performance.test.ts | 2 +- test/performance/bpmn.navigation.performance.test.ts | 2 +- test/unit/component/registry/bpmn-model-registry.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/performance/bpmn.load.performance.test.ts b/test/performance/bpmn.load.performance.test.ts index 3e32b17414..b407983029 100644 --- a/test/performance/bpmn.load.performance.test.ts +++ b/test/performance/bpmn.load.performance.test.ts @@ -38,7 +38,7 @@ describe('load performance', () => { const metric = { ...calculateMetrics(metricsStart, metricsEnd), run: run }; metricsArray.push(metric); - expect(true).toBe(true); + expect(true).toBeTrue(); }); }); afterAll(() => { diff --git a/test/performance/bpmn.navigation.performance.test.ts b/test/performance/bpmn.navigation.performance.test.ts index 905f71003a..d8700e11bf 100644 --- a/test/performance/bpmn.navigation.performance.test.ts +++ b/test/performance/bpmn.navigation.performance.test.ts @@ -63,7 +63,7 @@ describe('Mouse wheel zoom performance', () => { const metric = { ...calculateMetrics(metricsStart, metricsEnd), run: run }; metricsArray.push(metric); - expect(true).toBe(true); + expect(true).toBeTrue(); }); }); afterAll(() => { diff --git a/test/unit/component/registry/bpmn-model-registry.test.ts b/test/unit/component/registry/bpmn-model-registry.test.ts index 20a11b7e05..1fd3f414c8 100644 --- a/test/unit/component/registry/bpmn-model-registry.test.ts +++ b/test/unit/component/registry/bpmn-model-registry.test.ts @@ -27,7 +27,7 @@ describe('Bpmn Model registry', () => { const callback = jest.fn(); bpmnModelRegistry.registerOnLoadCallback(callback); bpmnModelRegistry.load(startEventInModel('id', 'name')); - expect(callback).toHaveBeenCalledTimes(1); + expect(callback).toHaveBeenCalledOnce(); }); it('search sequence flow', () => {