You signed in with another tab or window. Reload to refresh your session.You signed out in a
8000
nother tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to programmatically run files at a specific line for my guard. I have created a stackoverflow question and I'm wondering if you could help me.
using ruby #{file}:#{line} would work for you ?
... if it does then adding support for multiple lines might work too ...
or do you want to run the tests in the same process ? (spring-like)
Instead of using Matchdata (MatchData.new(file: filename_or_pathname)), I would like to run a test for every lines in modified_lines on filename_or_pathname
if there was only a single line, then would running `ruby #{file} -l
#{line}` work or do you need to run the test directly inside the current
process ?
If yes, then it should be possible to modify minitest-line to accept
multiple lines.
On Tue, Feb 6, 2018 at 1:54 AM, Alain ANDRE ***@***.***> wrote:
Hi @grosser <https://github.com/grosser>, I'm in a class inside my
guardfile.
What I need is when guard catch a modification, that it select the
modified lines of the changed file and start the test at this lines.
My Guardfile is like this
class GitModifiedMatcher
class MatchData
def initialize(result)
@Result = result
end
def to_a
@result.values
end
def [](name)
@Result[name]
end
end
def match(filename_or_pathname)
diff = `git diff --no-ext-diff --unified=0 --exit-code -a --no-prefix #{filename_or_pathname}`
modified_lines = diff.to_enum(:scan, /^@@ -\d+,?.* [+](\d+),?.* @@.*/).map { Regexp.last_match(1) }
return nil if modified_lines.count.zero?
#Minitest::Test.tests_with_lines
MatchData.new(file: filename_or_pathname)
endend
guard :minitest, all_on_start: false do
watch(GitModifiedMatcher.new)end
Instead of using Matchdata (MatchData.new(file: filename_or_pathname)), I
would like to run a test for every lines in modified_lines on
filename_or_pathname
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAsZzt2eddoDEAuPnvZhF08N6rfdcRoks5tSCE_gaJpZM4R5Rli>
.
Activity
grosser commentedon Feb 5, 2018
using
ruby #{file}:#{line}would work for you ?... if it does then adding support for multiple lines might work too ...
or do you want to run the tests in the same process ? (spring-like)
alain-andre commentedon Feb 6, 2018
Hi @grosser, I'm in a class inside my guardfile.
What I need is when guard catch a modification, that it select the modified lines of the changed file and start the test at this lines.
My Guardfile is like this
Instead of using Matchdata (
MatchData.new(file: filename_or_pathname)), I would like to run a test for every lines inmodified_linesonfilename_or_pathnamegrosser commentedon Feb 6, 2018
alain-andre commentedon Feb 7, 2018
@grosser I need to run it in current process. I changed my code this way :
It fails because it does not find
test_helperand then start to launch the whole tests of the file: