File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 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 {
6868 return internalRequestRegexp . test ( id )
6969}
7070
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+ ] )
7278
7379const builtins = new Set ( [
7480 ...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