Skip to content

Commit 82be00c

Browse files
andrewm4894claude
andcommitted
Fix docs test to handle Node.js version compatibility
Add Node.js version check to skip test gracefully when version <20.0 is detected, instead of failing. Docusaurus requires Node.js >=20.0 but local environment may have older versions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7409d45 commit 82be00c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/test_docs_links.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ def test_docusaurus_build_succeeds():
2020
if not (docs_dir / "node_modules").exists():
2121
pytest.skip("Node modules not installed. Run 'cd docs && yarn install' first.")
2222

23+
# Check Node.js version compatibility
24+
try:
25+
node_result = subprocess.run(
26+
["node", "--version"],
27+
capture_output=True,
28+
text=True,
29+
timeout=10
30+
)
31+
if node_result.returncode == 0:
32+
node_version = node_result.stdout.strip().lstrip('v')
33+
major_version = int(node_version.split('.')[0])
34+
if major_version < 20:
35+
pytest.skip(f"Node.js version {node_version} is incompatible. Docusaurus requires Node.js >=20.0")
36+
except (subprocess.TimeoutExpired, FileNotFoundError, ValueError):
37+
pytest.skip("Could not check Node.js version. Install Node.js >=20.0 to run this test.")
38+
2339
# Run docusaurus build which includes built-in link checking
2440
try:
2541
result = subprocess.run(
@@ -50,10 +66,11 @@ def test_docusaurus_build_succeeds():
5066

5167
print("🔍 Testing Docusaurus documentation...")
5268

53-
5469
try:
5570
test_docusaurus_build_succeeds()
5671
print("✅ Docusaurus build test passed")
72+
except pytest.skip.Exception as e:
73+
print(f"⏭️ Docusaurus build test skipped: {e}")
5774
except Exception as e:
5875
print(f"❌ Docusaurus build test failed: {e}")
5976
sys.exit(1)

0 commit comments

Comments
 (0)