[Bug 43517] New: Enable vue-tsc type checking and shared Cypress component-test shims
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Bug ID: 43517 Summary: Enable vue-tsc type checking and shared Cypress component-test shims Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Test Suite Assignee: chris@bigballofwax.co.nz Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Blocks: 41129 Target Milestone: --- This patch enables vue-tsc type checking for .vue files project-wide, and adds shared Cypress component-test environment shims that any future Vue component test can rely on. Specifically: - tsconfig.json: target the language level rspack/swc actually emit (ES2020), and let JSDoc types in .js files flow into type checking. - eslint.config.mjs: parse <script> blocks in .vue files with the TypeScript parser. - package.json: bump typescript and add vue-tsc as a dev dependency. - vue/ambient.d.ts: ambient module declarations for third-party libraries that ship without their own types (flatpickr, bootstrap Modal, vue-select), and for CSS side-effect imports. - t/cypress/support/console-hooks.js: shared hooks (used by both e2e and component tests) that make console.warn throw so real warnings fail tests fast, and that fail DataTables warnings logged via console.log. - t/cypress/support/component.ts: mirror the globals normally provided by page-level includes (window.dayjs, window.flatpickr with Koha's defaults, window.$timezone(), String.prototype.format) so components that depend on them can mount in isolation, and wire in the new console-hooks. None of this is feature-specific; it's split out from bug 41129 (booking workflows) because it benefits from independent review and several later patches depend on it. Test plan: 1. Run: yarn tsc --noEmit (or the project's vue-tsc check script) and confirm it passes with no new errors. 2. Run the full Cypress component suite and confirm nothing regresses. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41129 [Bug 41129] Migrate place_booking.js to a Vue island. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 205528 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205528&action=edit Bug 43517: Enable vue-tsc type checking and shared Cypress component-test shims Enable vue-tsc type checking for .vue files project-wide: - tsconfig.json: target the language level rspack/swc actually emit (ES2020), and let JSDoc types in .js files (within `include`) flow into type checking. - eslint.config.mjs: parse <script> blocks in .vue files with the TypeScript parser. - package.json/yarn.lock: bump typescript and add vue-tsc as a dev dependency. - koha-tmpl/intranet-tmpl/prog/js/vue/ambient.d.ts: ambient module declarations for third-party libraries that ship without their own types (flatpickr, bootstrap Modal, vue-select), and for CSS side-effect imports. Add shared Cypress component-test environment shims: - t/cypress/support/console-hooks.js: hooks shared by e2e and component tests that make console.warn throw so real warnings (Vue, deprecation) fail tests fast with a readable message, and that fail DataTables warnings logged via console.log. - t/cypress/support/component.ts: mirror the globals normally provided by page-level includes (window.dayjs, window.flatpickr with Koha's defaults, window.$timezone(), String.prototype.format) so components that depend on them can mount in isolation, and wire in the new console-hooks. Test plan: 1. Run: yarn tsc --noEmit (or the project's vue-tsc check script) and confirm it passes with no new errors. 2. Run the full Cypress component suite and confirm nothing regresses. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #205528|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 205546 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205546&action=edit Bug 43517: Enable vue-tsc type checking and shared Cypress component-test shims Enable vue-tsc type checking for .vue files project-wide: - tsconfig.json: target the language level rspack/swc actually emit (ES2020), and let JSDoc types in .js files (within `include`) flow into type checking. - eslint.config.mjs: parse <script> blocks in .vue files with the TypeScript parser. - package.json/yarn.lock: bump typescript and add vue-tsc as a dev dependency. - koha-tmpl/intranet-tmpl/prog/js/vue/ambient.d.ts: ambient module declarations for third-party libraries that ship without their own types (flatpickr, bootstrap Modal, vue-select), and for CSS side-effect imports. Add shared Cypress component-test environment shims: - t/cypress/support/console-hooks.js: hooks shared by e2e and component tests that make console.warn throw so real warnings (Vue, deprecation) fail tests fast with a readable message, and that fail DataTables warnings logged via console.log. - t/cypress/support/component.ts: mirror the globals normally provided by page-level includes (window.dayjs, window.flatpickr with Koha's defaults, window.$timezone(), String.prototype.format) so components that depend on them can mount in isolation, and wire in the new console-hooks. Split out from bug 41129 (booking workflows) as generic frontend tooling and test infrastructure. Test plan: 1. Run: yarn tsc --noEmit (or the project's vue-tsc check script) and confirm it passes with no new errors. 2. Run the full Cypress component suite and confirm nothing regresses. Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/> Assisted-by: Opus 4.8 (Anthropic) Assisted-by: GPT 5.6 (OpenAI) Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Jacob O'Mara <jacob.omara@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|chris@bigballofwax.co.nz |me@paulderscheid.xyz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jacob.omara@openfifth.co.uk |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|jacob.omara@openfifth.co.uk |matt.blenkinsop@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.derscheid@lmscloud.de Assignee|me@paulderscheid.xyz |paul.derscheid@lmscloud.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 --- Comment #3 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 205672 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205672&action=edit Bug 43517: (follow-up) Move String.prototype.format into str-format.js - Replace the component-test copy of String.prototype.format with the real definition: move it verbatim out of staff-global.js into js/str-format.js, loaded from js_includes.inc directly before staff-global.js. - Add an @js rspack alias for koha-tmpl/intranet-tmpl/prog/js, next to @fetch and @koha-vue, and import @js/str-format.js from t/cypress/support/component.ts. Test plan: 1. Run: yarn cypress run --component 2. Verify all specs pass. 3. Load any staff page and confirm js/str-format.js is served before staff-global.js and "%s".format("<string>") still works in the console. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43516 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43516 [Bug 43516] Harden the frontend HttpClient and add a shared API error formatter -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org