include stdout into the detail-float
All checks were successful
tests / test (push) Successful in 7s
All checks were successful
tests / test (push) Successful in 7s
This commit is contained in:
@@ -41,6 +41,15 @@ local function get_reporter_path()
|
||||
return vim.fs.normalize(dir .. "/../../reporter/test_samurai_jest_reporter.js")
|
||||
end
|
||||
|
||||
local function get_setup_path()
|
||||
local source = debug.getinfo(runner.build_command, "S").source
|
||||
if source:sub(1, 1) == "@" then
|
||||
source = source:sub(2)
|
||||
end
|
||||
local dir = vim.fs.dirname(source)
|
||||
return vim.fs.normalize(dir .. "/../../reporter/test_samurai_jest_stdout.js")
|
||||
end
|
||||
|
||||
describe("test-samurai-jest-runner", function()
|
||||
it("detects Jest test files by suffix and package.json", function()
|
||||
with_project(JEST_PACKAGE, function(root)
|
||||
@@ -176,6 +185,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
"--runTestsByPath",
|
||||
cmd_spec.cmd[#cmd_spec.cmd],
|
||||
},
|
||||
@@ -200,6 +211,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
"--runTestsByPath",
|
||||
"/tmp/math.test.js",
|
||||
"--testNamePattern",
|
||||
@@ -226,6 +239,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
"--runTestsByPath",
|
||||
"/tmp/math.test.js",
|
||||
"--testNamePattern",
|
||||
@@ -253,6 +268,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
"--runTestsByPath",
|
||||
root .. "/foo.test.ts",
|
||||
},
|
||||
@@ -276,6 +293,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
},
|
||||
cmd_spec.cmd
|
||||
)
|
||||
@@ -291,6 +310,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
"--runTestsByPath",
|
||||
"/tmp/math.test.js",
|
||||
"--testNamePattern",
|
||||
@@ -310,6 +331,8 @@ describe("test-samurai-jest-runner", function()
|
||||
"--testLocationInResults",
|
||||
"--reporters",
|
||||
get_reporter_path(),
|
||||
"--setupFilesAfterEnv",
|
||||
get_setup_path(),
|
||||
"--runTestsByPath",
|
||||
"/tmp/math.test.js",
|
||||
"--testNamePattern",
|
||||
@@ -395,18 +418,24 @@ describe("test-samurai-jest-runner", function()
|
||||
local output = table.concat({
|
||||
"TSAMURAI_RESULT " .. vim.json.encode({
|
||||
name = "Math/adds",
|
||||
jestName = "Math adds",
|
||||
status = "failed",
|
||||
output = { "line1", "line2" },
|
||||
}),
|
||||
"TSAMURAI_STDOUT " .. vim.json.encode({
|
||||
jestName = "Math adds",
|
||||
output = "log line",
|
||||
}),
|
||||
"TSAMURAI_RESULT " .. vim.json.encode({
|
||||
name = "Math/adds",
|
||||
jestName = "Math adds",
|
||||
status = "failed",
|
||||
output = { "line3" },
|
||||
}),
|
||||
}, "\n")
|
||||
|
||||
local results = runner.parse_test_output(output)
|
||||
assert.are.same({ "line1", "line2", "line3" }, results["Math/adds"])
|
||||
assert.are.same({ "line1", "line2", "log line", "line3" }, results["Math/adds"])
|
||||
end)
|
||||
|
||||
it("collect_failed_locations uses cached locations", function()
|
||||
|
||||
Reference in New Issue
Block a user