1
1
import { resolve } from 'path'
2
2
import { describe , expect , test } from 'vitest'
3
- import { transformSymbol } from '@unplugin-vue-cssvars/ utils'
3
+ import { normalizePath } from 'baiwusanyu- utils'
4
4
import { getAllCSSFilePath , preProcessCSS } from '../pre-process-css'
5
5
6
6
describe ( 'pre process css' , ( ) => {
@@ -11,8 +11,8 @@ describe('pre process css', () => {
11
11
includeCompile : [ '**/**.css' ] ,
12
12
} ,
13
13
)
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` )
16
16
const resTest1 = res . get ( mockPathTest1 )
17
17
const resTest2 = res . get ( mockPathTest2 )
18
18
expect ( resTest1 ) . toBeTruthy ( )
@@ -33,9 +33,9 @@ describe('pre process css', () => {
33
33
includeCompile : [ '**/**.css' , '**/**.scss' ] ,
34
34
} ,
35
35
)
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` )
39
39
// foo.scss -> test.css or test.scss ? -> test.scss
40
40
const importerFooSCSS = res . get ( mockPathFooSCSS )
41
41
expect ( [ ...importerFooSCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTestSCSS )
@@ -44,8 +44,8 @@ describe('pre process css', () => {
44
44
expect ( [ ...importerTestSCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
45
45
46
46
// 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` )
49
49
const importerFoo2SCSS = res . get ( mockPathFoo2SCSS )
50
50
expect ( [ ...importerFoo2SCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
51
51
// test2.css -> test.css or test.scss ? -> test.css
@@ -60,9 +60,9 @@ describe('pre process css', () => {
60
60
includeCompile : [ '**/**.css' , '**/**.less' ] ,
61
61
} ,
62
62
)
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` )
66
66
// foo.less -> test.css or test.less ? -> test.less
67
67
const importerFooLESS = res . get ( mockPathFooLESS )
68
68
expect ( [ ...importerFooLESS ! . importer ] [ 0 ] ) . toBe ( mockPathTestLESS )
@@ -71,8 +71,8 @@ describe('pre process css', () => {
71
71
expect ( [ ...importerTestLESS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
72
72
73
73
// 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` )
76
76
const importerFoo2LESS = res . get ( mockPathFoo2LESS )
77
77
expect ( [ ...importerFoo2LESS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
78
78
// test2.css -> test.css or test.less ? -> test.css
@@ -87,9 +87,9 @@ describe('pre process css', () => {
87
87
includeCompile : [ '**/**.css' , '**/**.styl' ] ,
88
88
} ,
89
89
)
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` )
93
93
// foo.styl -> test.css or test.styl ? -> test.styl
94
94
const importerFooSTYL = res . get ( mockPathFooSTYL )
95
95
expect ( [ ...importerFooSTYL ! . importer ] [ 0 ] ) . toBe ( mockPathTestSTYL )
@@ -98,8 +98,8 @@ describe('pre process css', () => {
98
98
expect ( [ ...importerTestSTYL ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
99
99
100
100
// 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` )
103
103
const importerFoo2STYL = res . get ( mockPathFoo2STYL )
104
104
expect ( [ ...importerFoo2STYL ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
105
105
// test2.css -> test.css or test.styl ? -> test.css
@@ -112,9 +112,9 @@ describe('pre process css', () => {
112
112
rootDir : resolve ( 'packages' ) ,
113
113
includeCompile : [ '**/**.css' , '**/**.sass' ] ,
114
114
} )
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` )
118
118
// foo.sass -> test.css or test.sass ? -> test.sass
119
119
const importerFooSASS = res . get ( mockPathFooSASS )
120
120
expect ( [ ...importerFooSASS ! . importer ] [ 0 ] ) . toBe ( mockPathTestSASS )
@@ -123,8 +123,8 @@ describe('pre process css', () => {
123
123
expect ( [ ...importerTestSASS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
124
124
125
125
// 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` )
128
128
const importerFoo2SASS = res . get ( mockPathFoo2SASS )
129
129
expect ( [ ...importerFoo2SASS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
130
130
// test2.css -> test.css or test.sass ? -> test.css
0 commit comments