Skip to content

Commit 51bf8db

Browse files
chore(deps): update dependency vitest to v3 (#355)
* chore(deps): update dependency vitest to v3 * fix: update lute wallet test for vitest v3 compatibility Update error handling test in `LuteWallet` to work with Vitest v3.0.9 upgrade from v2.1.8. The test was failing due to changes in error comparison behavior in v3. The changes include: - Creating `Error` instance with `Object.assign` to add code property - Updating assertion to use `toMatchObject` instead of `toThrow` - Removing unused `SignTxnsError` import * fix(solid): configure solid plugin for Vitest v3 tests Update `vite-plugin-solid` to v2.11.1 and explicitly add it to the Vitest configuration. Version 2.11.0 of vite-plugin-solid was incompatible with Vitest v3, causing "Client-only API called on the server side" errors in tests despite using the `jsdom` environment. This issue was resolved in `vite-plugin-solid` v2.11.1 (see solidjs/vite-plugin-solid#188). Explicitly adding the `solidPlugin` to `vitest.config.ts` ensures Solid-specific transformations are correctly applied during testing. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Doug Richar <[email protected]>
1 parent 525fc43 commit 51bf8db

File tree

4 files changed

+154
-74
lines changed

4 files changed

+154
-74
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"eslint-plugin-prettier": "5.2.1",
4141
"prettier": "3.4.2",
4242
"vite": "6.0.7",
43-
"vite-plugin-solid": "2.11.0",
44-
"vitest": "2.1.8",
43+
"vite-plugin-solid": "^2.11.1",
44+
"vitest": "3.0.9",
4545
"vue-demi": "0.14.10"
4646
}
4747
}

packages/use-wallet-solid/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
import solidPlugin from 'vite-plugin-solid'
12
import { defineConfig, mergeConfig } from 'vitest/config'
23
import viteConfig from './vite.config'
34

45
export default mergeConfig(
56
viteConfig,
67
defineConfig({
8+
plugins: [
9+
solidPlugin({
10+
ssr: false
11+
})
12+
],
713
test: {
814
name: 'use-wallet-solid',
915
dir: './src',

packages/use-wallet/src/__tests__/wallets/lute.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { StorageAdapter } from 'src/storage'
55
import { LOCAL_STORAGE_KEY, State, WalletState, DEFAULT_STATE } from 'src/store'
66
import { byteArrayToBase64 } from 'src/utils'
77
import { LuteWallet } from 'src/wallets/lute'
8-
import { SignTxnsError, WalletId } from 'src/wallets/types'
8+
import { WalletId } from 'src/wallets/types'
99
import type { Mock } from 'vitest'
1010

1111
// Mock logger
@@ -253,15 +253,15 @@ describe('LuteWallet', () => {
253253

254254
describe('signTransactions', () => {
255255
it('should re-throw SignTxnsError to the consuming application', async () => {
256-
const mockSignTxns = vi.fn().mockRejectedValue({
256+
const mockError = Object.assign(new Error('User Rejected Request'), { code: 4001 })
257+
const mockSignTxns = vi.fn().mockRejectedValue(mockError)
258+
vi.mocked(mockLuteConnect.signTxns).mockImplementation(mockSignTxns)
259+
260+
await expect(wallet.signTransactions([txn1])).rejects.toMatchObject({
261+
name: 'SignTxnsError',
257262
message: 'User Rejected Request',
258263
code: 4001
259264
})
260-
vi.mocked(mockLuteConnect.signTxns).mockImplementation(mockSignTxns)
261-
262-
await expect(wallet.signTransactions([txn1])).rejects.toThrow(
263-
new SignTxnsError('User Rejected Request', 4001)
264-
)
265265
})
266266

267267
it('should process and sign a single algosdk.Transaction', async () => {

0 commit comments

Comments
 (0)