Commit b628464 authored Jan 7, 2025 · 10 / 11 · Verified
1 parent 57c8740 commit b628464 Copy full SHA for b628464
File tree 2 files changed +36
-1
lines changed
2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ export function isInternalRequest(id: string): boolean {
68
68
return internalRequestRegexp . test ( id )
69
69
}
70
70
71
- const prefixedBuiltins = new Set ( [ 'node:test' ] )
71
+ // https://nodejs.org/api/modules.html#built-in-modules-with-mandatory-node-prefix
72
+ const prefixedBuiltins = new Set ( [
73
+ 'node:sea' ,
74
+ 'node:sqlite' ,
75
+ 'node:test' ,
76
+ 'node:test/reporters' ,
77
+ ] )
72
78
73
79
const builtins = new Set ( [
74
80
...builtinModules ,
Original file line number Diff line number Diff line change
1
+ import { expect , test } from 'vitest'
2
+ import { runInlineTests , ts } from '../../test-utils'
3
+
4
+ const nodeMajor = Number ( process . version . slice ( 1 ) . split ( '.' ) [ 0 ] )
5
+
6
+ test . runIf ( nodeMajor >= 22 ) ( 'import node:sqlite' , async ( ) => {
7
+ const { vitest, results } = await runInlineTests ( {
8
+ 'vitest.config.ts' : {
9
+ test : {
10
+ pool : 'forks' ,
11
+ poolOptions : {
12
+ forks : {
13
+ execArgv : [ '--experimental-sqlite' ] ,
14
+ } ,
15
+ } ,
16
+ } ,
17
+ } ,
18
+ 'basic.test.ts' : ts `
19
+ import { test, expect } from 'vitest'
20
+ import sqlite from 'node:sqlite'
21
+
22
+ test('sqlite', () => {
23
+ console.log(sqlite)
24
+ })
25
+ ` ,
26
+ } )
27
+ expect ( vitest . stderr ) . toBe ( '' )
28
+ expect ( results [ 0 ] . ok ( ) ) . toBe ( true )
29
+ } )
You can’t perform that action at this time.
0 commit comments