Created
March 6, 2025 19:49
-
-
Save rzane/e231eecf0df343e25b0066792997b111 to your computer and use it in GitHub Desktop.
Convert RSpec failed examples.txt to line numbers
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
require 'bundler/setup' | |
require 'rspec' | |
$LOAD_PATH.unshift(File.join(Dir.pwd, 'spec')) | |
ids = `grep '| failed' spec/examples.txt | sed 's/|.*//'`.lines(chomp: true).map(&:rstrip) | |
# Require each file | |
ids.each { |failure| require_relative failure.split('[')[0] } | |
# Print example locations | |
RSpec.world.all_examples.each do |example| | |
puts example.metadata[:location] if ids.include?(example.id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment