@@ -39,10 +39,22 @@ jobs:
|
|||||||
- name: Assert no banned vi.mock patterns
|
- name: Assert no banned vi.mock patterns
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
# Literal pdfjs-dist (libLoader pattern — ADR 012)
|
||||||
if grep -rF "vi.mock('pdfjs-dist'" frontend/src/; then
|
if grep -rF "vi.mock('pdfjs-dist'" frontend/src/; then
|
||||||
echo "FAIL: banned vi.mock('pdfjs-dist') pattern found — see ADR 012. Use the libLoader prop injection pattern instead."
|
echo "FAIL: banned vi.mock('pdfjs-dist') pattern found — see ADR 012. Use the libLoader prop injection pattern instead."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# Async factory with dynamic import in body (named mechanism — ADR 012 / #553).
|
||||||
|
# Multiline PCRE matches `vi.mock(<arg>, async ... { ... await import(...) ... })`
|
||||||
|
# across line breaks. __meta__ is excluded because it contains fixture strings
|
||||||
|
# demonstrating the very pattern this check is meant to forbid.
|
||||||
|
if grep -rPzln 'vi\.mock\([^)]+,\s*async[^{]*\{[\s\S]*?await\s+import\s*\(' \
|
||||||
|
--include='*.spec.ts' --include='*.test.ts' \
|
||||||
|
--exclude-dir='__meta__' \
|
||||||
|
frontend/src/; then
|
||||||
|
echo "FAIL: banned async vi.mock factory with dynamic import in body — see ADR 012 / #553. Use a synchronous factory + vi.hoisted instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Run unit and component tests with coverage
|
- name: Run unit and component tests with coverage
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
Reference in New Issue
Block a user