Skip to content

Commit 3857d2e

Browse files
committed
test: use npm provider in tests (to avoid network calls)
1 parent 212e175 commit 3857d2e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/nuxt/setup.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,14 @@ if (typeof window !== 'undefined') {
2323
removeColorScheme: () => {},
2424
}
2525
}
26+
27+
// force npm search provider in tests for compatibility with our mocks
28+
const settingsKey = 'npmx-settings'
29+
try {
30+
const existing = JSON.parse(localStorage.getItem(settingsKey) || '{}')
31+
existing.searchProvider = 'npm'
32+
localStorage.setItem(settingsKey, JSON.stringify(existing))
33+
} catch {
34+
localStorage.setItem(settingsKey, JSON.stringify({ searchProvider: 'npm' }))
35+
}
2636
}

0 commit comments

Comments
 (0)