[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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|41129 | 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 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |26.11 Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Sponsorship status|--- |Sponsored Status|Signed Off |Passed QA Comma delimited| |Büchereizentrale list of Sponsors| |Schleswig-Holstein | |<https://www.bz-sh.de/> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #205546|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 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #205672|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 #4 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206236 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206236&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> Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #5 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206237 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206237&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. Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #6 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206238 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206238&action=edit Bug 43517: (QA follow-up) Use console-hooks for e2e tests and add types:check script Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #7 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Added a follow-up, let me know if you disagree with anything -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com Status|Passed QA |Failed QA --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- +++ b/.claude/settings.local.json -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 --- Comment #9 from Jonathan Druart <jonathan.druart@gmail.com> --- I don't understand why you remove code from e2e.js in the last patch. Can you explain a bit more please? This code is supposed to catch warnings and raise them as error to make Cypress fails. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #9)
I don't understand why you remove code from e2e.js in the last patch. Can you explain a bit more please? This code is supposed to catch warnings and raise them as error to make Cypress fails.
Ok, sorry, I know read the whole patch set. Note that I keep the FQA status because of the extra file in the last patch. I also think that yarn.lock shouldn't be part of the first patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 --- Comment #11 from Jonathan Druart <jonathan.druart@gmail.com> --- A console.log has been removed from window:before:load, I think it's good to keep it, for debugging purpose (you see the original error) -- 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|Failed QA |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 ---------------------------------------------------------------------------- Attachment #206236|0 |1 is obsolete| | Attachment #206237|0 |1 is obsolete| | Attachment #206238|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 #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206529 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206529&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> Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #13 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206530 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206530&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. Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #14 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206531 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206531&action=edit Bug 43517: (QA follow-up) Use console-hooks for e2e tests and add types:check script Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #15 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206532 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206532&action=edit Bug 43517: (QA follow-up) Restore debug console output in console.warn/log hooks Bug 41129's comment in this file explains that a thrown console.warn can be silently swallowed by app-level try/catch (as flatpickr did), losing the thrown message entirely. Logging the raw args unconditionally was the only remaining trace in that case, but got dropped when the hooks moved into console-hooks.js. Restore it (as console.error, since the repo's pre-commit hook rejects console.log), and mirror it in the DataTables warning branch for consistency. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43517 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206529|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 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206530|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 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206531|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 Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206532|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 #16 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206622 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206622&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> Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #17 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206623 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206623&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. Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #18 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206624 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206624&action=edit Bug 43517: (QA follow-up) Use console-hooks for e2e tests and add types:check script Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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 --- Comment #19 from Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> --- Created attachment 206625 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206625&action=edit Bug 43517: (QA follow-up) Restore debug console output in console.warn/log hooks Bug 41129's comment in this file explains that a thrown console.warn can be silently swallowed by app-level try/catch (as flatpickr did), losing the thrown message entirely. Logging the raw args unconditionally was the only remaining trace in that case, but got dropped when the hooks moved into console-hooks.js. Restore it (as console.error, since the repo's pre-commit hook rejects console.log), and mirror it in the DataTables warning branch for consistency. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org