File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 "main" : " index.js" ,
77 "devDependencies" : {
88 "@tybys/wasm-util" : " ^0.8.3" ,
9+ "@vitest/browser-playwright" : " ^4.1.2" ,
910 "chalk" : " ^4.1.2" ,
1011 "cmake-js" : " ^7.3.0" ,
1112 "cross-env" : " ^7.0.3" ,
1213 "memfs-browser" : " ^3.5.10302" ,
1314 "nan" : " ^2.22.2" ,
1415 "node-addon-api" : " 8.6.0" ,
1516 "tap" : " ~0.7.1" ,
17+ "vite-plugin-node-polyfills" : " ^0.26.0" ,
18+ "vitest" : " ^4.1.2" ,
1619 "why-is-node-running" : " ^2.3.0"
1720 },
1821 "type" : " commonjs" ,
3639 "test:wasm32" : " cross-env NODE_TEST_KNOWN_GLOBALS=0 EMNAPI_TEST_WASM32=1 UV_THREADPOOL_SIZE=2 node ./script/test.js" ,
3740 "test:wasm32r" : " cross-env NODE_TEST_KNOWN_GLOBALS=0 EMNAPI_TEST_WASM32=1 UV_THREADPOOL_SIZE=2 NODE_ENV=production node ./script/test.js" ,
3841 "test:n" : " cross-env NODE_TEST_KNOWN_GLOBALS=0 EMNAPI_TEST_NATIVE=1 UV_THREADPOOL_SIZE=2 node ./script/test.js" ,
39- "test:nr" : " cross-env NODE_TEST_KNOWN_GLOBALS=0 EMNAPI_TEST_NATIVE=1 UV_THREADPOOL_SIZE=2 NODE_ENV=production node ./script/test.js"
42+ "test:nr" : " cross-env NODE_TEST_KNOWN_GLOBALS=0 EMNAPI_TEST_NATIVE=1 UV_THREADPOOL_SIZE=2 NODE_ENV=production node ./script/test.js" ,
43+ "test:browser" : " vitest run"
4044 },
4145 "repository" : {
4246 "type" : " git" ,
Original file line number Diff line number Diff line change 1+ import { defineConfig } from 'vitest/config'
2+ import { playwright } from '@vitest/browser-playwright'
3+ import { nodePolyfills } from 'vite-plugin-node-polyfills'
4+
5+ export default defineConfig ( {
6+ server : {
7+ headers : {
8+ "Cross-Origin-Embedder-Policy" : "require-corp" ,
9+ "Cross-Origin-Opener-Policy" : "same-origin"
10+ }
11+ } ,
12+ plugins : [
13+ nodePolyfills ( {
14+ include : [ 'assert' ] ,
15+ globals : {
16+ Buffer : true , // can also be 'build', 'dev', or false
17+ global : true ,
18+ process : true ,
19+ } ,
20+ overrides : {
21+ // Since `fs` is not supported in browsers, we can use the `memfs` package to polyfill it.
22+ fs : 'memfs-browser' ,
23+ } ,
24+ protocolImports : true ,
25+ } ) ,
26+ ] ,
27+ test : {
28+ include : [
29+ './**/*.{test,spec}.browser.js' ,
30+ ] ,
31+ browser : {
32+ enabled : true ,
33+ provider : playwright ( ) ,
34+ // https://vitest.dev/config/browser/playwright
35+ instances : [
36+ { browser : 'chromium' }
37+ ] ,
38+ } ,
39+ } ,
40+ } )
You can’t perform that action at this time.
0 commit comments