Skip to content

Commit

Permalink
Update the vitest config
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Feb 25, 2025
1 parent 3ac633e commit 25024b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ jobs:
- name: Install
run: yarn install --frozen-lockfile
- name: Build
run: bun run --filter '*' build
run: yarn build
- name: Generate
run: bun run --filter '*' generate
- name: Unit Tests
run: bun run --bun --filter '*' test:unit

4 changes: 1 addition & 3 deletions packages/as-sha256/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
"build:web": "webpack --mode production --entry ./index.js --output ./dist/as-sha256.min.js",
"build": "yarn asbuild && yarn asbuild:simd && yarn generate && yarn build:lib",
"test:unit": "vitest run --dir test/unit/",
"test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox",
"test:browsers:chrome": "vitest run --browser chrome --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:firefox": "vitest run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers": "vitest run --config ./vitest.browser.config.ts --dir test/unit",
"benchmark": "node -r ts-node/register ./node_modules/.bin/benchmark 'test/perf/*.test.ts'",
"benchmark:local": "yarn benchmark --local",
"test:ci": "yarn test:as-ci"
Expand Down
13 changes: 10 additions & 3 deletions vitest.base.browser.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig, mergeConfig } from "vitest/config";
import {nodePolyfills} from "vite-plugin-node-polyfills";
import { nodePolyfills } from "vite-plugin-node-polyfills";

import baseConfig from "./vitest.base.unit.config";

Expand All @@ -9,17 +9,24 @@ export default mergeConfig(
plugins: [
nodePolyfills({
include: ["buffer", "crypto", "util", "stream"],
globals: {Buffer: true},
globals: { Buffer: true },
protocolImports: true,
}),
],
test: {
browser: {
name: "chrome",
headless: true,
provider: "webdriverio",
screenshotFailures: false,
instances: [{ browser: "chrome" }, { browser: "firefox" }],
},
},
optimizeDeps: {
include: [
"vite-plugin-node-polyfills/shims/buffer",
"vite-plugin-node-polyfills/shims/global",
"vite-plugin-node-polyfills/shims/process",
],
},
})
);

0 comments on commit 25024b6

Please sign in to comment.