11import { resolve } from 'path'
22import { describe , expect , test } from 'vitest'
3- import { transformSymbol } from '@unplugin-vue-cssvars/ utils'
3+ import { normalizePath } from 'baiwusanyu- utils'
44import { getAllCSSFilePath , preProcessCSS } from '../pre-process-css'
55
66describe ( 'pre process css' , ( ) => {
@@ -11,8 +11,8 @@ describe('pre process css', () => {
1111 includeCompile : [ '**/**.css' ] ,
1212 } ,
1313 )
14- const mockPathTest1 = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
15- const mockPathTest2 = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
14+ const mockPathTest1 = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
15+ const mockPathTest2 = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
1616 const resTest1 = res . get ( mockPathTest1 )
1717 const resTest2 = res . get ( mockPathTest2 )
1818 expect ( resTest1 ) . toBeTruthy ( )
@@ -33,9 +33,9 @@ describe('pre process css', () => {
3333 includeCompile : [ '**/**.css' , '**/**.scss' ] ,
3434 } ,
3535 )
36- const mockPathFooSCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo.scss` )
37- const mockPathTestSCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.scss` )
38- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
36+ const mockPathFooSCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo.scss` )
37+ const mockPathTestSCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.scss` )
38+ const mockPathTest2CSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
3939 // foo.scss -> test.css or test.scss ? -> test.scss
4040 const importerFooSCSS = res . get ( mockPathFooSCSS )
4141 expect ( [ ...importerFooSCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTestSCSS )
@@ -44,8 +44,8 @@ describe('pre process css', () => {
4444 expect ( [ ...importerTestSCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
4545
4646 // foo2.scss -> test2.css
47- const mockPathFoo2SCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.scss` )
48- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
47+ const mockPathFoo2SCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.scss` )
48+ const mockPathTestCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
4949 const importerFoo2SCSS = res . get ( mockPathFoo2SCSS )
5050 expect ( [ ...importerFoo2SCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
5151 // test2.css -> test.css or test.scss ? -> test.css
@@ -60,9 +60,9 @@ describe('pre process css', () => {
6060 includeCompile : [ '**/**.css' , '**/**.less' ] ,
6161 } ,
6262 )
63- const mockPathFooLESS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo.less` )
64- const mockPathTestLESS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.less` )
65- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
63+ const mockPathFooLESS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo.less` )
64+ const mockPathTestLESS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.less` )
65+ const mockPathTest2CSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
6666 // foo.less -> test.css or test.less ? -> test.less
6767 const importerFooLESS = res . get ( mockPathFooLESS )
6868 expect ( [ ...importerFooLESS ! . importer ] [ 0 ] ) . toBe ( mockPathTestLESS )
@@ -71,8 +71,8 @@ describe('pre process css', () => {
7171 expect ( [ ...importerTestLESS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
7272
7373 // foo2.less -> test2.css
74- const mockPathFoo2LESS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.less` )
75- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
74+ const mockPathFoo2LESS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.less` )
75+ const mockPathTestCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
7676 const importerFoo2LESS = res . get ( mockPathFoo2LESS )
7777 expect ( [ ...importerFoo2LESS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
7878 // test2.css -> test.css or test.less ? -> test.css
@@ -87,9 +87,9 @@ describe('pre process css', () => {
8787 includeCompile : [ '**/**.css' , '**/**.styl' ] ,
8888 } ,
8989 )
90- const mockPathFooSTYL = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo.styl` )
91- const mockPathTestSTYL = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.styl` )
92- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
90+ const mockPathFooSTYL = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo.styl` )
91+ const mockPathTestSTYL = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.styl` )
92+ const mockPathTest2CSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
9393 // foo.styl -> test.css or test.styl ? -> test.styl
9494 const importerFooSTYL = res . get ( mockPathFooSTYL )
9595 expect ( [ ...importerFooSTYL ! . importer ] [ 0 ] ) . toBe ( mockPathTestSTYL )
@@ -98,8 +98,8 @@ describe('pre process css', () => {
9898 expect ( [ ...importerTestSTYL ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
9999
100100 // foo2.styl -> test2.css
101- const mockPathFoo2STYL = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.styl` )
102- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
101+ const mockPathFoo2STYL = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.styl` )
102+ const mockPathTestCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
103103 const importerFoo2STYL = res . get ( mockPathFoo2STYL )
104104 expect ( [ ...importerFoo2STYL ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
105105 // test2.css -> test.css or test.styl ? -> test.css
@@ -112,9 +112,9 @@ describe('pre process css', () => {
112112 rootDir : resolve ( 'packages' ) ,
113113 includeCompile : [ '**/**.css' , '**/**.sass' ] ,
114114 } )
115- const mockPathFooSASS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo.sass` )
116- const mockPathTestSASS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.sass` )
117- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
115+ const mockPathFooSASS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo.sass` )
116+ const mockPathTestSASS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.sass` )
117+ const mockPathTest2CSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test2.css` )
118118 // foo.sass -> test.css or test.sass ? -> test.sass
119119 const importerFooSASS = res . get ( mockPathFooSASS )
120120 expect ( [ ...importerFooSASS ! . importer ] [ 0 ] ) . toBe ( mockPathTestSASS )
@@ -123,8 +123,8 @@ describe('pre process css', () => {
123123 expect ( [ ...importerTestSASS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
124124
125125 // foo2.sass -> test2.css
126- const mockPathFoo2SASS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.sass` )
127- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
126+ const mockPathFoo2SASS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/foo2.sass` )
127+ const mockPathTestCSS = normalizePath ( `${ resolve ( ) } /core/runtime/__test__/style/test.css` )
128128 const importerFoo2SASS = res . get ( mockPathFoo2SASS )
129129 expect ( [ ...importerFoo2SASS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
130130 // test2.css -> test.css or test.sass ? -> test.css
0 commit comments