File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 11import { resolve } from 'path'
2- import { Context } from '../src/context'
2+ import { Context } from '../src/core/context'
3+
4+ const root = resolve ( __dirname , '../examples/vite-vue3' )
35
46function cleanup ( data : any ) {
57 return Object . values ( data ) . map ( ( e : any ) => {
68 delete e . absolute
9+ e . path = e . path . replace ( root , '' )
710 return e
811 } ) . sort ( ( a , b ) => ( a . name as string ) . localeCompare ( b . name ) )
912}
1013
1114describe ( 'search' , ( ) => {
1215 it ( 'should work' , async ( ) => {
13- const ctx = new Context ( { } , { root : resolve ( __dirname , '../examples/vue3' ) } as any )
16+ const ctx = new Context ( { } )
17+ ctx . setRoot ( root )
1418 ctx . searchGlob ( )
1519
1620 expect ( cleanup ( ctx . componentNameMap ) ) . toMatchSnapshot ( )
@@ -20,7 +24,8 @@ describe('search', () => {
2024 const ctx = new Context ( {
2125 directoryAsNamespace : true ,
2226 globalNamespaces : [ 'global' ] ,
23- } , { root : resolve ( __dirname , '../examples/vue3' ) } as any )
27+ } )
28+ ctx . setRoot ( root )
2429 ctx . searchGlob ( )
2530
2631 expect ( cleanup ( ctx . componentNameMap ) ) . toMatchSnapshot ( )
Original file line number Diff line number Diff line change 1- import { Context } from '../src/context'
2- import { stringifyComponentImport } from '../src/utils'
1+ import { Context } from '../src/core/ context'
2+ import { stringifyComponentImport } from '../src/core/ utils'
33
44describe ( 'stringifyComponentImport' , ( ) => {
55 it ( 'importName' , async ( ) => {
6- const ctx = new Context ( { } , { root : '' } as any )
6+ const ctx = new Context ( { } )
77 expect (
88 stringifyComponentImport ( {
99 name : 'Test' ,
@@ -14,7 +14,7 @@ describe('stringifyComponentImport', () => {
1414 } )
1515
1616 it ( 'plain css sideEffects' , async ( ) => {
17- const ctx = new Context ( { } , { root : '' } as any )
17+ const ctx = new Context ( { } )
1818 expect (
1919 stringifyComponentImport ( {
2020 name : 'Test' ,
@@ -25,7 +25,7 @@ describe('stringifyComponentImport', () => {
2525 } )
2626
2727 it ( 'multiple sideEffects' , async ( ) => {
28- const ctx = new Context ( { } , { root : '' } as any )
28+ const ctx = new Context ( { } )
2929 expect (
3030 stringifyComponentImport ( {
3131 name : 'Test' ,
You can’t perform that action at this time.
0 commit comments