Files
nextcloud-server-mirror/vitest.config.ts
Ferdinand Thiessen 6bea7197d7 test(core): ignore the jsdom focus-trap error of NcPopover in the Vue 3 unit tests
NcPopover passes its fallback element to focus-trap as `fallBackFocus`, an
option focus-trap does not know, so the trap has no fallback. jsdom has
no layout, so nothing in the popover content counts as tabbable and
activating the trap throws. Vue 2 only logged that asynchronous handler
error, while Vue 3 rethrows it in development mode, so every popover
opened by the app menu spec was counted as an unhandled error and failed
the run. The error is filtered next to the existing NcModal workaround.

Assisted-by: ClaudeCode:claude-fable-5-1
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-10-06 14:35:09 +02:00

41 lines
1.4 KiB
TypeScript

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: CC0-1.0
*/
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
projects: [
'build/frontend*',
],
onUnhandledError(error) {
// TODO: remove when this is fixed: https://github.com/nextcloud-libraries/nextcloud-vue/issues/8090
if (error.message.includes('`fallbackFocus` was specified but was not a node, or did not return a node')) {
return false
}
// NcPopover passes its fallback as `fallBackFocus`, which focus-trap does
// not know, and jsdom has no layout so nothing counts as tabbable.
// TODO: remove once NcPopover sets `fallbackFocus`.
if (error.message.includes('Your focus-trap must have at least one container with at least one tabbable node')) {
return false
}
// A worker that still has console output in flight when it shuts down
// fails the run even though every test passed. The specs that log
// heavily (the focus trap above prints per interaction) hit this
// depending on how the files are spread over the workers.
if (error.name === 'EnvironmentTeardownError' && error.message.includes('Closing rpc while')) {
return false
}
},
},
server: {
watch: {
ignored(path: string) {
return !/(\/|build\/frontend[^/]*\/)(apps|core)\/(src|tests)\//.test(path)
},
},
},
})