Skip to content

Commit e52c884

Browse files
committed
test: normalize watch matrix paths on windows
1 parent 8aeeab5 commit e52c884

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/weapp-tailwindcss/test/watch-hmr-coverage-matrix.unit.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ function toSlashPath(filePath: string) {
5858
return filePath.replace(/\\/g, '/')
5959
}
6060

61+
function toRepoPath(filePath: string) {
62+
return toSlashPath(filePath).replace(/^[A-Z]:(?=\/)/i, '')
63+
}
64+
6165
function expectDemoSourceFile(sourceFile: string, message: string) {
62-
const normalizedSourceFile = toSlashPath(sourceFile)
66+
const normalizedSourceFile = toRepoPath(sourceFile)
6367

6468
expect(normalizedSourceFile, `${message} should edit demo source files`).toContain('/repo/demo/')
6569
expect(normalizedSourceFile, `${message} should not edit generated dist files`).not.toContain('/dist/')
@@ -180,8 +184,8 @@ describe('watch-hmr coverage matrix', () => {
180184
const watchCase = automatedWatchCases.find(item => item.project === 'demo/taro-webpack-vue3-tailwindcss-v4')
181185

182186
expect(watchCase).toBeDefined()
183-
expect(watchCase?.styleMutation?.sourceFile).toBe('/repo/demo/taro-webpack-vue3-tailwindcss-v4/src/pages/index/index.css')
184-
expect(watchCase?.outputStyleCandidates).toContain('/repo/demo/taro-webpack-vue3-tailwindcss-v4/dist/app.wxss')
187+
expect(toRepoPath(watchCase?.styleMutation?.sourceFile ?? '')).toBe('/repo/demo/taro-webpack-vue3-tailwindcss-v4/src/pages/index/index.css')
188+
expect(watchCase?.outputStyleCandidates.map(toRepoPath)).toContain('/repo/demo/taro-webpack-vue3-tailwindcss-v4/dist/app.wxss')
185189
})
186190

187191
it('keeps the automated watch matrix explicit', () => {

0 commit comments

Comments
 (0)