Skip to content

Commit 1815112

Browse files
authored
chore(tests): reorganize (#1231)
1 parent c24a93a commit 1815112

29 files changed

Lines changed: 771 additions & 698 deletions

.github/workflows/test-multiple-builds.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
- name: Patch for DEV-ONLY
3232
if: ${{ matrix.env == 'development' }}
3333
run: |
34-
sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it('/" tests/*.ts tests/*.tsx
35-
sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it.skip('/" tests/*.ts tests/*.tsx
34+
find tests -type f \( -name '*.ts' -o -name '*.tsx' \) -exec sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it('/" {} +
35+
find tests -type f \( -name '*.ts' -o -name '*.tsx' \) -exec sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it.skip('/" {} +
3636
- name: Patch for PRD-ONLY
3737
if: ${{ matrix.env == 'production' }}
3838
run: |
39-
sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it('/" tests/*.ts tests/*.tsx
40-
sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it.skip('/" tests/*.ts tests/*.tsx
39+
find tests -type f \( -name '*.ts' -o -name '*.tsx' \) -exec sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it('/" {} +
40+
find tests -type f \( -name '*.ts' -o -name '*.tsx' \) -exec sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it.skip('/" {} +
4141
- name: Patch for CJS
4242
if: ${{ matrix.build == 'cjs' }}
4343
run: |
@@ -46,7 +46,7 @@ jobs:
4646
if: ${{ matrix.build == 'esm' }}
4747
run: |
4848
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/esm\1.mjs')/" vitest.config.mts
49-
sed -i~ "1s/^/import.meta.env.MODE='${NODE_ENV}';/" tests/*.ts tests/*.tsx
49+
find tests -type f \( -name '*.ts' -o -name '*.tsx' \) -exec sed -i~ "1s/^/import.meta.env.MODE='${NODE_ENV}';/" {} +
5050
env:
5151
NODE_ENV: ${{ matrix.env }}
5252
- name: Test ${{ matrix.build }} ${{ matrix.env }}

.github/workflows/test-multiple-versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Patch for React 16
4242
if: ${{ startsWith(matrix.react, '16.') }}
4343
run: |
44-
sed -i~ '1s/^/import React from "react";/' tests/*.tsx
44+
find tests -type f -name '*.tsx' -exec sed -i~ '1s/^/import React from "react";/' {} +
4545
sed -i~ 's/"jsx": "react-jsx"/"jsx": "react"/' tsconfig.json
4646
sed -i~ 's/import\.meta\.env[?]\.MODE/"DEVELOPMENT".toLowerCase()/' src/*.ts src/*/*.ts src/*/*/*.ts
4747
- name: Test ${{ matrix.react }}

0 commit comments

Comments
 (0)