@@ -39,19 +39,41 @@ async function safeRm(target: string) {
3939async function clearTailwindPatchCaches ( root : string ) {
4040 const workspaceRoot = path . resolve ( root , '..' , '..' )
4141 const candidates = new Set < string > ( [
42+ path . resolve ( root , 'dist' ) ,
43+ path . resolve ( root , 'unpackage' ) ,
4244 path . resolve ( root , 'node_modules/.cache/tailwindcss-patch' ) ,
45+ path . resolve ( root , 'node_modules/.cache/weapp-tailwindcss' ) ,
4346 path . resolve ( root , 'src/node_modules/.cache/tailwindcss-patch' ) ,
47+ path . resolve ( root , 'src/node_modules/.cache/weapp-tailwindcss' ) ,
4448 path . resolve ( root , 'config/node_modules/.cache/tailwindcss-patch' ) ,
49+ path . resolve ( root , 'config/node_modules/.cache/weapp-tailwindcss' ) ,
50+ path . resolve ( root , '.tw-patch/tailwindcss-target.json' ) ,
4551 path . resolve ( root , 'node_modules/.vite' ) ,
4652 path . resolve ( workspaceRoot , 'node_modules/.cache/tailwindcss-patch' ) ,
53+ path . resolve ( workspaceRoot , 'node_modules/.cache/weapp-tailwindcss' ) ,
4754 path . resolve ( workspaceRoot , 'packages/weapp-tailwindcss/node_modules/.cache/tailwindcss-patch' ) ,
55+ path . resolve ( workspaceRoot , 'packages/weapp-tailwindcss/node_modules/.cache/weapp-tailwindcss' ) ,
4856 ] )
4957
5058 await Promise . all (
5159 Array . from ( candidates , target => safeRm ( target ) ) ,
5260 )
5361}
5462
63+ export async function clearProjectBuildState ( root : string ) {
64+ await clearTailwindPatchCaches ( root )
65+ }
66+
67+ function shouldSkipAutomator ( entry : ProjectEntry ) {
68+ if ( entry . skipOpenAutomator ) {
69+ return true
70+ }
71+ if ( process . env . E2E_OPEN_AUTOMATOR === '1' ) {
72+ return false
73+ }
74+ return process . env . CI === 'true' || process . env . CI === '1'
75+ }
76+
5577async function expectProjectSnapshot ( suite : string , projectName : string , fileName : string , content : string ) {
5678 const snapshotPath = await resolveSnapshotFile ( __dirname , suite , projectName , fileName )
5779 await expect ( content ) . toMatchFileSnapshot ( snapshotPath )
@@ -140,16 +162,14 @@ async function runProjectTest(entry: ProjectEntry, options: ProjectTestOptions)
140162 const root = path . resolve ( projectBase , entry . name )
141163 const shouldResetPatchCaches = ! entry . name . startsWith ( 'taro-' )
142164
143- if ( shouldResetPatchCaches ) {
144- await clearTailwindPatchCaches ( root )
145- }
165+ await clearProjectBuildState ( root )
146166
147167 if ( process . env . E2E_SKIP_BUILD !== '1' ) {
148168 await ensureProjectBuilt ( root )
149169 }
150170
151171 if ( shouldResetPatchCaches ) {
152- await clearTailwindPatchCaches ( root )
172+ await clearProjectBuildState ( root )
153173 }
154174
155175 let extraction
@@ -194,7 +214,7 @@ async function runProjectTest(entry: ProjectEntry, options: ProjectTestOptions)
194214 await expectProjectSnapshot ( options . suite , entry . name , snapshot . fileName , snapshot . content )
195215 }
196216
197- if ( entry . skipOpenAutomator ) {
217+ if ( shouldSkipAutomator ( entry ) ) {
198218 await wait ( )
199219 return
200220 }
0 commit comments