Add regression tests for backtrace source mapping#12
Merged
Conversation
Failing tests must report line numbers from the source the developer wrote, not the transformed code that executes. Unit tests cover RSpock::BacktraceFilter and the Minitest wrapper against a real registered SourceMap; a subprocess integration test pins the end-to-end behavior, including one test documenting that the Minitest plugin filter is still required — ast-transform's compile-with-source-path fix corrected file paths but line mapping still needs the filter. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
e65a92c(compile ISeq with the original source path) made backtrace file paths correct without the filter, but line numbers still come from the transformed source; onlyRSpock::BacktraceFilter+ the SourceMap maps them back. None of this was covered by tests.test/rspock/backtrace_filter_test.rb: unit tests forfilter_string(line mapping, transformed-path mapping,?for unmappable lines, pass-through without a SourceMap),filter_exception, and theRSpock::Minitest::BacktraceFilterwrapper — all against a real SourceMap registered by running a fixture through the actual transform pipeline in a tmpdir (no filesystem mocks).test/rspock/backtrace_source_mapping_test.rb: subprocess integration test running a genuinely failing RSpock test file end to end, asserting failure output cites source line numbers (computed from the fixture, not hardcoded). A second test runs the same fixture with the plugin filter left uninstalled and asserts the cited lines differ — this is the canary that fails if the plugin ever genuinely becomes redundant, so future cleanup can be evidence-based.Notes for review
MT_NO_PLUGINS=1(minitest's gem-scan plugin discovery activates the Ruby default-gem minitest over the-Ione and breaks the run); the enabled variant callsMinitest.plugin_rspock_init({})explicitly — the same call plugin discovery would make.backtrace_locationsresolves/varsymlinks to/private/var, and SourceMap registration is keyed by exact path string.Test plan
bundle exec rake test— 236 tests, 0 failures (was 228)Made with Cursor