- SOURCE_DIRS 에 ui_template · A00_Common(하위 폴더째 · node_modules 뺌) · SOURCE_GLOBS 에 config/*.ts - 새 logic/ 하위 폴더 잡힘 · node_modules · CAD 앱은 안 봄 — 시험 test_342_4_bundle_stale.py Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
69 lines
2.0 KiB
Python
69 lines
2.0 KiB
Python
"""342-4 서버 Node 묶음 낡음 판정 — 묶음이 끌어가는 화면 공용 · config · 새 logic/ 하위 폴더도 잡음.
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_342_4_bundle_stale.py -q
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from common_util import common_util_node_bundle as nb
|
|
|
|
BUILT_AT = 1_000_000_000
|
|
|
|
|
|
@pytest.fixture
|
|
def tree(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
|
monkeypatch.setattr(nb, "ROOT", tmp_path)
|
|
bundle = tmp_path / "dist" / "bundle.mjs"
|
|
bundle.parent.mkdir()
|
|
bundle.write_text("", encoding="utf-8")
|
|
os.utime(bundle, (BUILT_AT, BUILT_AT))
|
|
return bundle
|
|
|
|
|
|
def _touch(root: Path, rel: str, when: int) -> None:
|
|
path = root / rel
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text("", encoding="utf-8")
|
|
os.utime(path, (when, when))
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"rel",
|
|
[
|
|
"B05_Profile/logic/B05_Profile_Footprint.ts",
|
|
"B06_Section/logic/B06_Section_Xxx.ts",
|
|
"ui_template/b_notice.ts",
|
|
"ui_template/locale/b_text.ts",
|
|
"A00_Common/b_page_state.ts",
|
|
"A00_Common/design/design_store.ts",
|
|
"config/config_frontend.ts",
|
|
"common_util/common_util_cross_design.ts",
|
|
"B07_DesignDetail/B07_DesignDetail_UI_Cad.ts",
|
|
],
|
|
)
|
|
def test_새로_고친_TS_는_낡음(tree: Path, rel: str) -> None:
|
|
_touch(nb.ROOT, rel, BUILT_AT + 10)
|
|
assert nb.bundle_stale(tree)
|
|
|
|
|
|
def test_오래된_TS_뿐이면_그대로(tree: Path) -> None:
|
|
_touch(nb.ROOT, "B05_Profile/logic/B05_Profile_Footprint.ts", BUILT_AT - 10)
|
|
_touch(nb.ROOT, "ui_template/b_notice.ts", BUILT_AT - 10)
|
|
assert not nb.bundle_stale(tree)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"rel",
|
|
[
|
|
"config/node_modules/typescript/lib/x.d.ts",
|
|
"A00_Common/config/node_modules/.vite/deps/x.ts",
|
|
"B07_DesignDetail/openwebcad/src/x.ts",
|
|
],
|
|
)
|
|
def test_node_modules_CAD_앱은_안_봄(tree: Path, rel: str) -> None:
|
|
_touch(nb.ROOT, rel, BUILT_AT + 10)
|
|
assert not nb.bundle_stale(tree)
|