File tree Expand file tree Collapse file tree
packages/cli/snap-tests/vite-plugins-async-test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import fs from 'node:fs' ;
2+ import path from 'node:path' ;
3+
14export default function myVitestPlugin ( ) {
25 return {
36 name : 'my-vitest-plugin' ,
4- config ( ) {
5- return {
6- test : {
7- env : {
8- MY_VITEST_PLUGIN_LOADED : '1' ,
9- } ,
10- } ,
11- } ;
7+ configureVitest ( ) {
8+ fs . writeFileSync (
9+ path . join ( import . meta. dirname , '.vitest-plugin-loaded' ) ,
10+ 'configureVitest hook executed' ,
11+ ) ;
1212 } ,
1313 } ;
1414}
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs' ;
2+ import path from 'node:path' ;
3+
14import { expect , test } from '@voidzero-dev/vite-plus-test' ;
25
3- test ( 'async plugin factory should load vitest plugin' , ( ) => {
4- expect ( process . env . MY_VITEST_PLUGIN_LOADED ) . toBe ( '1' ) ;
6+ test ( 'async plugin factory should load vitest plugin with configureVitest hook' , ( ) => {
7+ const markerPath = path . join ( import . meta. dirname , '..' , '.vitest-plugin-loaded' ) ;
8+ expect ( fs . existsSync ( markerPath ) ) . toBe ( true ) ;
9+ expect ( fs . readFileSync ( markerPath , 'utf-8' ) ) . toBe ( 'configureVitest hook executed' ) ;
10+ fs . unlinkSync ( markerPath ) ;
511} ) ;
You can’t perform that action at this time.
0 commit comments