File tree Expand file tree Collapse file tree 2 files changed +2
-45
lines changed
Expand file tree Collapse file tree 2 files changed +2
-45
lines changed Original file line number Diff line number Diff line change 11import '@testing-library/jest-dom/vitest'
2- import { vi } from 'vitest'
3-
4- // Mock browser APIs
5- interface GlobalWithBrowser {
6- browser : {
7- runtime : {
8- sendMessage : ReturnType < typeof vi . fn >
9- onMessage : {
10- addListener : ReturnType < typeof vi . fn >
11- }
12- }
13- }
14- chrome : GlobalWithBrowser [ 'browser' ]
15- }
16-
17- const globalWithBrowser = global as unknown as GlobalWithBrowser
18-
19- globalWithBrowser . browser = {
20- runtime : {
21- onMessage : {
22- addListener : vi . fn ( ) ,
23- } ,
24- sendMessage : vi . fn ( ) ,
25- } ,
26- }
27-
28- globalWithBrowser . chrome = globalWithBrowser . browser
29-
30- // Mock console methods to reduce noise in tests
31- global . console = {
32- ...console ,
33- debug : vi . fn ( ) ,
34- error : vi . fn ( ) ,
35- info : vi . fn ( ) ,
36- log : vi . fn ( ) ,
37- warn : vi . fn ( ) ,
38- }
Original file line number Diff line number Diff line change 1- import path from 'node:path'
21import { defineConfig } from 'vitest/config'
2+ import { WxtVitest } from 'wxt/testing'
33
44export default defineConfig ( {
5- resolve : {
6- alias : {
7- '@' : path . resolve ( __dirname , './entrypoints' ) ,
8- '@content' : path . resolve ( __dirname , './entrypoints/content' ) ,
9- '@utils' : path . resolve ( __dirname , './entrypoints/content/utils' ) ,
10- } ,
11- } ,
5+ plugins : [ WxtVitest ( ) ] ,
126 test : {
137 coverage : {
148 exclude : [
You can’t perform that action at this time.
0 commit comments