Skip to content

Commit dff34d7

Browse files
committed
Suppress some noisy log lines
Closes #686
1 parent d2244ba commit dff34d7

File tree

7 files changed

+39
-9
lines changed

7 files changed

+39
-9
lines changed

src/Toast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const Toast: FC<Props> = ({
8686
<DialogOverlay
8787
className={classNames(overlayStyles.bg, overlayStyles.animate)}
8888
/>
89-
<DialogContent asChild>
89+
<DialogContent aria-describedby={undefined} asChild>
9090
<DialogClose
9191
className={classNames(
9292
overlayStyles.overlay,

src/analytics/PosthogAnalytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class PosthogAnalytics {
144144
advanced_disable_decide: true,
145145
});
146146
this.enabled = true;
147-
} else {
147+
} else if (import.meta.env.MODE !== "test") {
148148
logger.info(
149149
"Posthog is not enabled because there is no api key or no host given in the config",
150150
);

src/widget.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ export const widget = ((): WidgetHelpers | null => {
178178

179179
return { api, lazyActions, client: clientPromise };
180180
} else {
181-
logger.info("No widget API available");
181+
if (import.meta.env.MODE !== "test")
182+
logger.info("No widget API available");
182183
return null;
183184
}
184185
} catch (e) {

test/__snapshots__/Toast-test.tsx.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
exports[`Toast renders 1`] = `
44
<button
5-
aria-describedby="radix-:r5:"
65
aria-labelledby="radix-:r4:"
76
class="overlay animate toast"
87
data-state="open"

test/home/CallList-test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ import { ClientProvider } from "../../src/ClientContext";
2424
describe("CallList", () => {
2525
const renderComponent = (rooms: GroupCallRoom[]): RenderResult => {
2626
return render(
27-
<ClientProvider>
28-
<MemoryRouter>
29-
<CallList client={{} as MatrixClient} rooms={rooms} />
30-
</MemoryRouter>
31-
</ClientProvider>,
27+
<MemoryRouter>
28+
<CallList client={{} as MatrixClient} rooms={rooms} />
29+
</MemoryRouter>,
3230
);
3331
};
3432

test/setup.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Copyright 2024 New Vector Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import i18n from "i18next";
18+
import posthog from "posthog-js";
19+
import { initReactI18next } from "react-i18next";
20+
21+
// Bare-minimum i18n config
22+
i18n.use(initReactI18next).init({
23+
lng: "en-GB",
24+
fallbackLng: "en-GB",
25+
interpolation: {
26+
escapeValue: false, // React has built-in XSS protections
27+
},
28+
});
29+
30+
posthog.opt_out_capturing();

vitest.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default defineConfig((configEnv) =>
1414
},
1515
},
1616
include: ["test/**/*-test.[jt]s?(x)"],
17+
isolate: false,
18+
setupFiles: ["test/setup.ts"],
1719
coverage: {
1820
reporter: ["html", "json"],
1921
include: ["src/"],

0 commit comments

Comments
 (0)