Skip to content

Fix test type imports for SimpleConstraint#58

Merged
TimBeyer merged 1 commit intomasterfrom
fix-test-type-imports
Jan 15, 2026
Merged

Fix test type imports for SimpleConstraint#58
TimBeyer merged 1 commit intomasterfrom
fix-test-type-imports

Conversation

@TimBeyer
Copy link
Owner

Summary

Fix test imports to use type-only imports for TypeScript interfaces that don't exist in JavaScript runtime.

Problem

After updating Mocha to 11.7.5, tests were failing with:

SyntaxError: The requested module '../../index.js' does not provide an export named 'SimpleConstraint'

This occurred because SimpleConstraint is a TypeScript interface (type-only) that doesn't exist in the compiled JavaScript. When importing from the built JS files, the interface isn't available.

Solution

Change the import to use TypeScript's type import syntax:

import type { SimpleConstraint } from '../../index.js'

This tells TypeScript that SimpleConstraint is only used for type annotations and should be stripped during compilation.

Test plan

  • All 48 unit tests passing
  • Code formatted with Prettier
  • Linting passes
  • Production build completes successfully

🤖 Generated with Claude Code

Fix test imports to use type-only imports for TypeScript interfaces.
SimpleConstraint is a TypeScript interface that doesn't exist in
JavaScript runtime, so it must be imported as a type.

This resolves the "The requested module does not provide an export
named 'SimpleConstraint'" error that occurred after updating Mocha
to 11.7.5.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@TimBeyer TimBeyer merged commit 19517ec into master Jan 15, 2026
11 checks passed
@TimBeyer TimBeyer deleted the fix-test-type-imports branch January 15, 2026 03:18
@github-actions
Copy link
Contributor

🚀 Benchmark Results

Performance comparison against merge-base db5ed46

bun-latest

dancing-links@4.3.6 compare-benchmarks
npm run build:dev && node built/scripts/compare-benchmarks.js baseline-results-bun-latest.json pr-results-bun-latest.json

dancing-links@4.3.6 build:dev
npm run clean && tsc -p tsconfig.dev.json

dancing-links@4.3.6 clean
rimraf built

🚀 Benchmark Results

All solutions to the sudoku

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 3,690.238 ±0.21% 3,996.22 ±0.24% +8.29% ✅ Improvement
dancing-links (sparse) 14,308.216 ±0.14% 14,944.357 ±0.12% +4.45% ✅ Improvement
dancing-links generator 14,191.94 ±0.13% 14,524.322 ±0.14% +2.34% ✅ Improvement
dancing-links template 15,414.709 ±0.11% 15,320.398 ±0.11% -0.61% ➡️ No significant change

Finding one pentomino tiling on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 394.157 ±0.56% 407.51 ±0.52% +3.39% ✅ Improvement
dancing-links (sparse) 444.916 ±0.51% 458.278 ±0.46% +3.00% ✅ Improvement
dancing-links generator 442.991 ±0.43% 427.128 ±0.76% -3.58% ⚠️ Minor regression
dancing-links template 434.712 ±0.40% 440.507 ±0.33% +1.33% ➡️ No significant change

Finding ten pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 61.141 ±1.73% 65.504 ±1.03% +7.14% ✅ Improvement
dancing-links (sparse) 65.434 ±1.32% 66.548 ±0.61% +1.70% ➡️ No significant change
dancing-links generator 68.469 ±0.95% 69.119 ±1.11% +0.95% ➡️ No significant change
dancing-links template 67.81 ±1.03% 66.747 ±0.65% -1.57% ➡️ No significant change

Finding one hundred pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 8.806 ±2.01% 9.226 ±2.77% +4.78% ✅ Improvement
dancing-links (sparse) 8.643 ±2.20% 8.821 ±3.43% +2.06% ✅ Improvement
dancing-links generator 9.413 ±0.68% 9.425 ±0.91% +0.13% ➡️ No significant change
dancing-links template 9.399 ±0.77% 9.772 ±1.06% +3.98% ✅ Improvement

Updated: 2026-01-15T03:19:12.190Z

node-22

dancing-links@4.3.6 compare-benchmarks
npm run build:dev && node built/scripts/compare-benchmarks.js baseline-results-node-22.json pr-results-node-22.json

dancing-links@4.3.6 build:dev
npm run clean && tsc -p tsconfig.dev.json

dancing-links@4.3.6 clean
rimraf built

🚀 Benchmark Results

All solutions to the sudoku

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 3,097.068 ±0.33% 3,166.776 ±0.32% +2.25% ✅ Improvement
dancing-links (sparse) 13,266.036 ±0.15% 13,549.869 ±0.15% +2.14% ✅ Improvement
dancing-links generator 13,442.734 ±0.17% 13,520.018 ±0.14% +0.57% ➡️ No significant change
dancing-links template 15,017.598 ±0.12% 14,587.427 ±0.14% -2.86% ⚠️ Minor regression

Finding one pentomino tiling on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 377.399 ±0.70% 380.833 ±0.48% +0.91% ➡️ No significant change
dancing-links (sparse) 432.702 ±0.37% 414.978 ±0.36% -4.10% ⚠️ Minor regression
dancing-links generator 413.664 ±0.47% 416.41 ±0.38% +0.66% ➡️ No significant change
dancing-links template 409.856 ±0.59% 416.824 ±0.41% +1.70% ➡️ No significant change

Finding ten pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 62.835 ±1.63% 62.656 ±0.48% -0.29% ➡️ No significant change
dancing-links (sparse) 63.418 ±1.25% 62.754 ±1.05% -1.05% ➡️ No significant change
dancing-links generator 63.267 ±1.01% 66.272 ±0.78% +4.75% ✅ Improvement
dancing-links template 67.372 ±1.13% 63.79 ±1.17% -5.32% ⚠️ Minor regression

Finding one hundred pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 8.985 ±1.16% 9.064 ±0.40% +0.88% ➡️ No significant change
dancing-links (sparse) 9.061 ±0.79% 8.82 ±1.62% -2.67% ⚠️ Minor regression
dancing-links generator 8.99 ±1.51% 9.111 ±0.52% +1.35% ➡️ No significant change
dancing-links template 9.003 ±1.25% 9.125 ±0.35% +1.35% ➡️ No significant change

Updated: 2026-01-15T03:19:14.829Z

node-24

dancing-links@4.3.6 compare-benchmarks
npm run build:dev && node built/scripts/compare-benchmarks.js baseline-results-node-24.json pr-results-node-24.json

dancing-links@4.3.6 build:dev
npm run clean && tsc -p tsconfig.dev.json

dancing-links@4.3.6 clean
rimraf built

🚀 Benchmark Results

All solutions to the sudoku

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 5,052.711 ±0.27% 5,208.499 ±0.27% +3.08% ✅ Improvement
dancing-links (sparse) 13,304.152 ±0.13% 12,475.231 ±0.17% -6.23% ⚠️ Minor regression
dancing-links generator 13,518.993 ±0.11% 13,039.63 ±0.14% -3.55% ⚠️ Minor regression
dancing-links template 14,581.089 ±0.13% 14,409.199 ±0.13% -1.18% ➡️ No significant change

Finding one pentomino tiling on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 420.075 ±0.34% 408.98 ±0.47% -2.64% ⚠️ Minor regression
dancing-links (sparse) 438.817 ±0.47% 431.702 ±0.56% -1.62% ➡️ No significant change
dancing-links generator 431.892 ±0.47% 430.273 ±0.58% -0.37% ➡️ No significant change
dancing-links template 442.492 ±0.51% 428.649 ±0.67% -3.13% ⚠️ Minor regression

Finding ten pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 67.427 ±0.65% 62.808 ±1.16% -6.85% ⚠️ Minor regression
dancing-links (sparse) 67.74 ±0.62% 62.723 ±1.16% -7.41% ⚠️ Minor regression
dancing-links generator 65.216 ±1.09% 63.935 ±1.17% -1.96% ➡️ No significant change
dancing-links template 64.27 ±1.07% 63.264 ±1.46% -1.57% ➡️ No significant change

Finding one hundred pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 9.046 ±0.45% 8.924 ±2.31% -1.34% ➡️ No significant change
dancing-links (sparse) 8.57 ±1.83% 9.06 ±1.91% +5.72% ✅ Improvement
dancing-links generator 9.202 ±0.90% 9.264 ±0.44% +0.68% ➡️ No significant change
dancing-links template 9.3 ±0.68% 9.284 ±0.79% -0.17% ➡️ No significant change

Updated: 2026-01-15T03:19:18.054Z

node-25

dancing-links@4.3.6 compare-benchmarks
npm run build:dev && node built/scripts/compare-benchmarks.js baseline-results-node-25.json pr-results-node-25.json

dancing-links@4.3.6 build:dev
npm run clean && tsc -p tsconfig.dev.json

dancing-links@4.3.6 clean
rimraf built

🚀 Benchmark Results

All solutions to the sudoku

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 5,404.34 ±0.24% 5,580.366 ±0.18% +3.26% ✅ Improvement
dancing-links (sparse) 13,322.415 ±0.16% 13,590.812 ±0.15% +2.01% ✅ Improvement
dancing-links generator 13,360.953 ±0.16% 13,645.871 ±0.16% +2.13% ✅ Improvement
dancing-links template 14,796.149 ±0.13% 14,916.623 ±0.11% +0.81% ➡️ No significant change

Finding one pentomino tiling on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 421.796 ±0.52% 419.918 ±0.45% -0.45% ➡️ No significant change
dancing-links (sparse) 446.153 ±0.45% 422.949 ±0.44% -5.20% ⚠️ Minor regression
dancing-links generator 428.963 ±0.56% 440.84 ±0.63% +2.77% ✅ Improvement
dancing-links template 450.67 ±0.49% 449.353 ±0.58% -0.29% ➡️ No significant change

Finding ten pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 61.429 ±1.80% 64.872 ±0.54% +5.60% ✅ Improvement
dancing-links (sparse) 64.926 ±1.00% 65.173 ±0.89% +0.38% ➡️ No significant change
dancing-links generator 63.864 ±1.58% 66.56 ±1.37% +4.22% ✅ Improvement
dancing-links template 63.639 ±1.36% 65.4 ±0.64% +2.77% ✅ Improvement

Finding one hundred pentomino tilings on a 6x10 field

Library Baseline (ops/sec) PR (ops/sec) Change Performance
dancing-links (binary) 9.322 ±0.91% 9.445 ±0.99% +1.32% ➡️ No significant change
dancing-links (sparse) 9.194 ±1.08% 9.419 ±0.86% +2.45% ✅ Improvement
dancing-links generator 9.344 ±1.24% 9.564 ±1.04% +2.35% ✅ Improvement
dancing-links template 9.488 ±1.26% 9.518 ±1.31% +0.31% ➡️ No significant change

Updated: 2026-01-15T03:19:15.592Z

ℹ️ Benchmark Details
  • Baseline: Merge-base commit db5ed46 where this PR branched from master
  • Comparison: Current PR head fbab779
  • Timestamp: 2026-01-15 03:19:25 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant