Skip to content

Commit

Permalink
Improve VSCode test running tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Jul 12, 2024
1 parent 2ee6e50 commit b3a89b1
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 12 deletions.
174 changes: 162 additions & 12 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,197 @@
"kind": "test",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"clear": true,
"reveal": "always",
"revealProblems": "onProblem",
},
"problemMatcher": [
// Sadly VSCode has problems with multiline messages: https://github.com/microsoft/vscode/issues/9635
// {
// "owner": "ruby",
// "fileLocation": "absolute",
// "severity": "error",
// "pattern": [
// {
// "regexp": "^(Error):$",
// "message": 1
// },
// // Capture test
// {
// "regexp": "^(.*)#.*?:$",
// "message": 1,
// },
// // Capture exception
// {
// "regexp": "^(.*):$",
// "message": 1,
// },
// // Capture path
// {
// "regexp": "^\\s*\\[(\\S+):([0-9]+)\\]$",
// "file": 2,
// "line": 3
// },
// ]
// },
{
"owner": "ruby",
"fileLocation": "absolute",
"severity": "error",
"pattern": [
{
"regexp": "^(Failure):$",
"message": 1
},
{
"regexp": "^(.*)#.* \\[(\\S+):([0-9]+)\\]$",
"message": 1,
"file": 2,
"line": 3
},
// Sadly VSCode has problems with multiline messages: https://github.com/microsoft/vscode/issues/9635
// {
// "regexp": "^.*(Expected: .*)$",
// "message": 1,
// },
// {
// "regexp": "^.*(Actual: .*)$",
// "message": 1,
// }
]
},
{
"owner": "ruby",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": {
"regexp": "^(.*) \\[(\\S+):([0-9]+)\\]:$",
"file": 2,
"line": 3,
"message": 1
}
"fileLocation": "absolute",
"severity": "info",
"pattern": [
{
"regexp": "^(Skipped):$",
"message": 1,
},
// Capture path
{
"regexp": "^(.*) \\[(\\S+):([0-9]+)\\]:$",
"file": 2,
"line": 3
},
// Capture test
{
"regexp": "^(.*)#.*?$",
"message": 1,
},
// Sadly VSCode has problems with multiline messages: https://github.com/microsoft/vscode/issues/9635
// // Capture skip message
// {
// "regexp": "^(.*)$",
// "message": 1,
// },
]
}
],
"label": "rake: test",
"command": "env MINITEST_REPORTER=RubyMineReporter bundle exec rake minitest:test"
"command": "env MINITEST_REPORTER=DefaultReporter bundle exec rake test"
},
{
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"clear": true,
"reveal": "always",
"revealProblems": "onProblem",
},
"problemMatcher": [
// Sadly VSCode has problems with multiline messages: https://github.com/microsoft/vscode/issues/9635
// {
// "owner": "ruby",
// "fileLocation": "absolute",
// "severity": "error",
// "pattern": [
// {
// "regexp": "^(Error):$",
// "message": 1
// },
// // Capture test
// {
// "regexp": "^(.*)#.*?:$",
// "message": 1,
// },
// // Capture exception
// {
// "regexp": "^(.*):$",
// "message": 1,
// },
// // Capture path
// {
// "regexp": "^\\s*\\[(\\S+):([0-9]+)\\]$",
// "file": 2,
// "line": 3
// },
// ]
// },
{
"owner": "ruby",
"fileLocation": "absolute",
"severity": "error",
"pattern": [
{
"regexp": "^(Failure):$",
"severity": 1,
"message": 1
},
{
"regexp": "^(.*)#.* \\[(\\S+):([0-9]+)\\]$",
"message": 1,
"file": 2,
"line": 3
},
// Sadly VSCode has problems with multiline messages: https://github.com/microsoft/vscode/issues/9635
// {
// "regexp": "^.*(Expected: .*)$",
// "message": 1,
// },
// {
// "regexp": "^.*(Actual: .*)$",
// "message": 1,
// }
]
},
{
"owner": "ruby",
"fileLocation": "absolute",
"severity": "info",
"pattern": [
{
"regexp": "^(.*) \\[(\\S+):([0-9]+)\\][:]?$",
"regexp": "^(Skipped):$",
"message": 1,
},
// Capture path
{
"regexp": "^(.*) \\[(\\S+):([0-9]+)\\]:$",
"file": 2,
"line": 3
}
},
// Capture test
{
"regexp": "^(.*)#.*?$",
"message": 1,
},
// Sadly VSCode has problems with multiline messages: https://github.com/microsoft/vscode/issues/9635
// // Capture skip message
// {
// "regexp": "^(.*)$",
// "message": 1,
// },
]
}
],
"label": "rake: spec",
"command": "env MINITEST_REPORTER=RubyMineReporter bundle exec rake minitest:spec"
"command": "env MINITEST_REPORTER=DefaultReporter bundle exec rake spec"
}
]
}
11 changes: 11 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# frozen_string_literal: true

require "minitest/reporters"

# Minitest::Reporters::DefaultReporter misreports `skip` location
# as being in Minitest source instead of actual `skip` location
# See: https://github.com/minitest-reporters/minitest-reporters/issues/356
module FixSkipLocation
def location(exception)
exception.location
end
end
Minitest::Reporters::DefaultReporter.prepend FixSkipLocation

Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new

0 comments on commit b3a89b1

Please sign in to comment.