test(store-adapter): better-sqlite3 native binding probe 강화#271
Open
tellang wants to merge 1 commit into
Open
Conversation
`store-adapter*.test.mjs` 의 graceful skip 로직이 `await import("better-sqlite3")`
성공 시 즉시 통과시켰다. 하지만 dynamic loader 는 native `.node` 파일 미해상
상황에서도 module export 자체는 성공시키는 경우가 있어 (예: Node v26.0.0 +
better-sqlite3 12.6.2 — node-gyp rebuild 실패), 후속 `new Database(...)` 또는
`db.prepare("...")` 호출에서 `Cannot read properties of null (reading "prepare")`
같은 TypeError 가 발생했다. release `prepare.mjs` 가 native test runner 의
exit non-zero 를 그대로 감지해 release 가 abort 되는 회귀.
## 변경
`import` 성공 후 즉시 `new ctor(":memory:")` + `prepare("SELECT 1").get()`
probe 호출. native binding 미해상 시 throw → `t.skip(...)` 으로 graceful
skip. CI (Linux fresh install) 에서는 native binding 정상이라 기존대로
실제 sqlite path 검증, mac Node v26 같은 환경에서는 skip 으로 회귀 가드.
## Test
- `node --test tests/unit/store-adapter.test.mjs tests/unit/store-adapter-tier2.test.mjs`
→ 4 tests / 2 pass / 2 skipped / 0 fail (native binding 미해상 환경)
- CI (Linux Ubuntu, fresh install) 에서는 native binding 정상이라 변화 없이
pass 유지 기대
- `npm run lint` clean
## 동기
v10.21.0 release 의 `prepare:execute` 가 본 native binding 미해상으로 abort
하여 `--skip-tests` 우회로 진행했다. 본 fix 로 후속 release 는 mac Node v26
환경에서도 정상 prepare 통과 가능.
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.
Summary
store-adapter*.test.mjs의 graceful skip 로직이await import("better-sqlite3")성공 시 즉시 통과시켰다. dynamic loader 는 native
.node파일 미해상 상황에서도 module export 자체는 성공시키는 경우가 있어 (예: Node v26.0.0 +
better-sqlite3 12.6.2 — node-gyp rebuild 실패), 후속
new Database(...)/db.prepare("...")호출에서TypeError: Cannot read properties of null (reading "prepare")가 발생했다.release
prepare.mjs가 native test runner 의 exit non-zero 를 그대로감지해 release 가 abort 되는 회귀.
변경
import성공 후 즉시new ctor(":memory:")+prepare("SELECT 1").get()probe 호출. native binding 미해상 시 throw →
t.skip(...)으로 gracefulskip.
Test plan
node --test tests/unit/store-adapter.test.mjs tests/unit/store-adapter-tier2.test.mjs→ 4 tests / 2 pass / 2 skipped / 0 fail (native binding 미해상 환경)
npm run lintclean동기
v10.21.0 release 의
prepare:execute가 본 native binding 미해상으로 abort하여
--skip-tests우회로 진행. 본 fix 로 후속 release 는 mac Node v26환경에서도 정상 prepare 통과 가능.