From 5732faee1e7d378fa99d74bb437de502ed64ca2d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 11 Feb 2024 11:37:21 +0100 Subject: [PATCH] Prevent duplicate names in unit/integration tests Having identical names for different test-cases may result in less helpful output, which we can avoid with the use of the ESLint Jasmine plugin. This patch enables the rules at the `branch` level, to limit the amount/scope of the changes slightly. (We could thus make this rule more strict in the future, if that's deemed useful.) Please refer to: - https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/no-spec-dupes.md - https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/no-suite-dupes.md --- test/.eslintrc | 4 ++-- test/integration/find_spec.mjs | 3 ++- test/unit/scripting_spec.js | 2 +- test/unit/xfa_parser_spec.js | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/.eslintrc b/test/.eslintrc index 77388ebfc0ef0..4f371e4248581 100644 --- a/test/.eslintrc +++ b/test/.eslintrc @@ -10,8 +10,8 @@ "jasmine/new-line-between-declarations": "off", "jasmine/no-focused-tests": "error", "jasmine/no-pending-tests": "off", - "jasmine/no-spec-dupes": "off", - "jasmine/no-suite-dupes": "off", + "jasmine/no-spec-dupes": ["error", "branch"], + "jasmine/no-suite-dupes": ["error", "branch"], "jasmine/prefer-jasmine-matcher": "off", "jasmine/prefer-toHaveBeenCalledWith": "off" } diff --git a/test/integration/find_spec.mjs b/test/integration/find_spec.mjs index f460163cad31a..36e635ec3b3a9 100644 --- a/test/integration/find_spec.mjs +++ b/test/integration/find_spec.mjs @@ -72,7 +72,8 @@ describe("find bar", () => { ); }); }); - describe("highlight all", () => { + + describe("highlight all (XFA)", () => { let pages; beforeAll(async () => { diff --git a/test/unit/scripting_spec.js b/test/unit/scripting_spec.js index f9fbb58cec805..69dfa3207b02f 100644 --- a/test/unit/scripting_spec.js +++ b/test/unit/scripting_spec.js @@ -999,7 +999,7 @@ describe("Scripting", function () { }); }); - it("should format a date", async () => { + it("should format a date (cFormat)", async () => { const refId = getId(); const data = { objects: { diff --git a/test/unit/xfa_parser_spec.js b/test/unit/xfa_parser_spec.js index 11e2036c2ba74..7a1e7f69fb203 100644 --- a/test/unit/xfa_parser_spec.js +++ b/test/unit/xfa_parser_spec.js @@ -1021,7 +1021,7 @@ describe("XFAParser", function () { ).toBe("SW1"); }); - it("should make basic binding with extra subform", function () { + it("should make basic binding with extra subform (consumeData)", function () { const xml = `