From bc60f8ab5ef6ad1af3f172e59f5ba1ae28ba5692 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 15 Jan 2024 09:55:33 +0000 Subject: [PATCH] fix(test): avoid component re-registration warning during unit tests (#2006) I noticed we were getting warnings for re-registering a component due to https://github.com/kumahq/kuma-gui/pull/1981 This happens both in browser development environments (PR previews and locally) and also CLI based unit tests. The unit test ones are noisier than the browser ones, seeing as the browser ones need to be looked for. This PR only does the re-registration if we don't have a `process` meaning it doesn't happen in anything CLI based. Signed-off-by: John Cowen --- src/services/development.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/services/development.ts b/src/services/development.ts index 4e636211e..6e864cbd6 100644 --- a/src/services/development.ts +++ b/src/services/development.ts @@ -71,9 +71,14 @@ export const services: ServiceConfigurator = (app) => [ [token('development.components'), { service: () => { - return [ - ['KClipboardProvider', DebugKClipboardProvider], - ] + // unit testing is likely to have process + // no matter which runner is used + // if we are unit testing don't decorate KClipboardProvider + return typeof process === 'undefined' + ? [ + ['KClipboardProvider', DebugKClipboardProvider], + ] + : [] }, labels: [ app.components,