Skip to content

Commit

Permalink
fix(vitest): config and type tweaks
Browse files Browse the repository at this point in the history
* need to inline `@nextcloud/dialogs` so `@nextcloud/vue`
  is always inlined.
* specify setup file in vite config.
* add types for window.t and window.n
* get `t` from window.t in Menu/keys.js

Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud committed Oct 13, 2024
1 parent cf111ed commit 5e95f3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Menu/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

const t = window.t
const isMac = (navigator.userAgent.includes('Mac'))

const MODIFIERS = {
Expand Down
3 changes: 3 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

declare global {
interface Window {
// Nextcloud Globals
t: typeof import('@nextcloud/l10n').t
n: typeof import('@nextcloud/l10n').n
OCA: Record<string, any>
OCP: Nextcloud.v29.OCP
}
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ const config = createAppConfig({
},
},
test: {
setupFiles: ['src/tests/setup.mjs'],
environment: 'jsdom',
globals: true,
server: {
deps: {
inline: ['@nextcloud/vue'],
inline: [/@nextcloud.*/],
}
},
},
Expand Down

0 comments on commit 5e95f3b

Please sign in to comment.