test(integration): emotion v10 격리 fixture + e2e 커버리지 + bundle config 버그 수정#2255
Merged
Conversation
## 배경
emotion 100% 지원 목표 — v10 (legacy) 사용자 케이스 검증 필요.
v10 의 `@emotion/core` entry 는 v11 의 `@emotion/react` 와 별도 패키지라
같은 node_modules 트리에 공존이 어려움. **격리 fixture 로 해결**.
## 발견 + 수정한 버그
`packages/core/bin/zts.mjs` 의 `runBundle` 이 `compiler:` 옵션을 forward
누락 — `zts.config.json` 의 `compiler.emotion` / `compiler.styledComponents`
가 bundle 모드에서 silently drop 됐다. `zts build` (app 모드) 는 이미 forward
하고 있었으니 mode 간 split 이 원인. v10 e2e 테스트가 이 버그를 노출.
## 추가 인프라
- `tests/integration/fixtures/emotion-v10/` — 격리된 `package.json` + `bun.lock`.
`@emotion/core@10`, `@emotion/styled@10`, `@emotion/css@10`, `react@16` 설치.
CI: `cd tests/integration/fixtures/emotion-v10 && bun install` 사전 실행 필요.
- `helpers.ts` 에 `EMOTION_V10_FIXTURE_NODE_MODULES` / `hasEmotionV10Fixture()`
/ `linkNodeModules({ extraRoots })` (v10 root 우선 검색) / `runZtsInDir` 의
`bin: "zig" | "js"` 옵션 (JS CLI 통한 NAPI 검증).
## 테스트 커버리지
**유닛 (`emotion_test.zig` +5 케이스)**:
- `@emotion/core` 의 css / keyframes / 동시 import / JSX inline / alias
**통합 (`emotion-v10.test.ts` 9 케이스, `runV10Bundle` 헬퍼로 boilerplate 흡수)**:
- @emotion/core: css binding / keyframes / css+keyframes 동시 / JSX inline css
- @emotion/styled v10: styled.div / styled(Component) chain
- 옵션: emotion 비활성 / autoLabel disable
- 격리 검증: fixture 의 @emotion/core 가 실제 v10.x 인지
## 코드 리뷰 (3-agent /simplify)
발견된 모든 P1/P2 반영:
- `runZtsInDir` / `runZtsJsInDir` 17 줄 byte-for-byte 중복 → `bin` discriminator
- v10 통합 테스트 9× boilerplate (~150 줄) → `runV10Bundle` 헬퍼
- 무의미한 `out.length > 5000` byte count 체크 제거
- 유닛 테스트 naming 기존 패턴 일치 (`(v10):` → `@emotion/core (v10)`)
- WHAT-narrating 주석 제거 (의미 있는 WHY 만 유지)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2nd /simplify pass 결과 반영: - 번들 실패 시 stderr/stdout 포함해 throw — silent 빈 `out` 으로 인한 헷갈리는 assertion 메시지 방지 - `entry` 기본값 `"index.tsx"` → `"index.ts"` (9개 중 6개 override 하던 footgun) - JSX inline 케이스만 명시적 `entry: "index.tsx"` Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Smoke Test Results (CI)Smoke Test Results
Size Comparison (ZTS vs smallest of esbuild/rolldown/rspack)
Average ratio (vs smallest): 0.87x | Smaller: 120 | Similar(±10%): 17 | Larger: 7
|
Benchmark Results (CI)macos-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
small (100 lines)
medium (1K lines)
large (5K lines)
xlarge (10K lines)
ubuntu-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
small (100 lines)
medium (1K lines)
large (5K lines)
xlarge (10K lines)
windows-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
small (100 lines)
medium (1K lines)
large (5K lines)
xlarge (10K lines)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경
emotion 100% 지원 목표 — v10 (legacy) 사용자 케이스 검증. v10 의
@emotion/coreentry 는 v11 의@emotion/react와 별도 패키지라 같은 node_modules 트리에 공존이 어려움. 격리 fixture 로 해결.발견 + 수정한 버그
packages/core/bin/zts.mjs의runBundle이compiler:옵션을 forward 누락 —zts.config.json의compiler.emotion/compiler.styledComponents가 bundle 모드에서 silently drop 됐다.zts build(app 모드) 는 이미 forward 하고 있어 mode 간 split 이 원인. v10 e2e 테스트가 이 버그를 노출.이 버그는
zts --bundle entry.ts -o out.js를 쓰는 모든 사용자 영향.zts build만 쓰던 사용자는 영향 없음.추가 인프라
격리 fixture
CI:
cd tests/integration/fixtures/emotion-v10 && bun install사전 실행 필요.helpers 확장
EMOTION_V10_FIXTURE_NODE_MODULES/hasEmotionV10Fixture()linkNodeModules({ extraRoots })— v10 fixture 를 lookup 우선순위 첫째로runZtsInDir(dir, args, { bin: "zig" | "js" })— JS CLI (bun +bin/zts.mjs) 통한 NAPI 검증 옵션 추가.compiler.emotion같은 JS-only 옵션은 Zig CLI 미노출이라 JS CLI 경로 필수.테스트 커버리지
유닛 (
emotion_test.zig+5 케이스):@emotion/core의 css / keyframes / 동시 import / JSX inline / alias통합 (
emotion-v10.test.ts9 케이스) —runV10Bundle({source, config, packages?})헬퍼로 boilerplate 흡수:@emotion/core: css binding / keyframes / css+keyframes 동시 / JSX inline css (jsx pragma 포함)@emotion/styledv10:styled.div/styled(Component)chainemotion: false비활성 /emotion.autoLabel: false@emotion/core가 실제^10.인지코드 리뷰 (3-agent /simplify)
발견된 모든 P1/P2 반영:
runZtsInDir/runZtsJsInDir17 줄 byte-for-byte 중복bindiscriminator 통합runV10Bundle헬퍼로 흡수out.length > 5000byte count 체크(v10):일관성 깨짐@emotion/core (v10)형태로순효과: +502 / -3 lines, 테스트는 +14 케이스 (유닛 5 + 통합 9).
검증
zig build test— 4203/4203 통과bun test tests/emotion-v10.test.ts— 9/9 통과bun test tests/css-library-smoke.test.ts(v11 회귀) — 9/9 통과bun test tests/zts-config-bundler.test.ts(helpers 시그니처 변경 회귀) — 13/13 통과🤖 Generated with Claude Code