Files
js/packages/thirdweb/test/vitest.config.ts
T
kien-ngo 810f319579 [SDK] onTimeout for useAutoConnect | TOOL-2673 (#5879)
TOOL-2673

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces an `onTimeout` callback to the `useAutoConnect` hook, enhancing its functionality by allowing users to define custom behavior when a connection attempt times out. It also includes tests for the new feature and refactors some wallet connection logic.

### Detailed summary
- Added `onTimeout` callback to `useAutoConnect`.
- Updated `useAutoConnectCore` to handle wallet connections with the new `onTimeout` feature.
- Refactored `handleWalletConnection` function to improve clarity.
- Added unit tests for `getUrlToken` covering various scenarios.
- Updated test configurations for better matching of test files.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2025-01-05 21:40:06 +00:00

48 lines
1.3 KiB
TypeScript

import { join } from "node:path";
import codspeedPlugin from "@codspeed/vitest-plugin";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vitest/config";
const plugins = process.env.CI ? [codspeedPlugin()] : [];
export default defineConfig({
plugins: [...plugins, react()],
test: {
alias: {
"~test": join(__dirname, "./src"),
},
benchmark: {},
coverage: {
all: false,
provider: "v8",
reporter: process.env.CI ? ["lcov"] : ["text", "json", "html"],
exclude: [
// test files do not count
"**/*.test.ts",
"**/*.test.tsx",
// benchmark files do not count
"**/*.bench.ts",
// anything inside /test/ does not count
"**/test/**",
// generated files do not count
"**/__generated__/**",
// exports do not count
"src/exports/**",
],
include: ["src/**"],
},
environmentMatchGlobs: [["src/**/*.test.tsx", "happy-dom"]],
environment: "node",
include: ["src/**/*.test.{ts,tsx}"],
setupFiles: [join(__dirname, "./reactSetup.ts")],
globalSetup: [join(__dirname, "./globalSetup.ts")],
testTimeout: 90_000,
retry: process.env.CI ? 3 : 0,
maxConcurrency: 3,
bail: 1,
// clear any mocks between any tests
clearMocks: true,
pool: "forks",
},
});