Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use uv.fs_mkdir to create directories and changed reports dir #142

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lua/neotest-java/core/spec_builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local build_tools = require("neotest-java.build_tool")
local nio = require("nio")
local run = require("neotest-java.command.run")
local compiler = require("neotest-java.build_tool.compiler")
local path = require("plenary.path")

SpecBuilder = {}

Expand All @@ -25,11 +26,14 @@ function SpecBuilder.build_spec(args, project_type, config)
nio.fn.chdir(root)

-- make sure outputDir is created to operate in it
local outputDir = build_tools.get(project_type).get_output_dir()
run({ "mkdir", "-p", outputDir })
local output_dir = build_tools.get(project_type).get_output_dir()
local output_dir_parent = path:new(output_dir):parent().filename

vim.uv.fs_mkdir(output_dir_parent, 493)
vim.uv.fs_mkdir(output_dir, 493)

-- JUNIT REPORT DIRECTORY
local reports_dir = "/tmp/neotest-java/" .. nio.fn.strftime("%d%m%y%H%M%S")
local reports_dir = string.format("%s/junit-reports/%s", output_dir, nio.fn.strftime("%d%m%y%H%M%S"))
command:reports_dir(reports_dir)

-- TEST SELECTORS
Expand Down
3 changes: 2 additions & 1 deletion lua/neotest-java/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local log = require("neotest-java.logger")
local ch = require("neotest-java.context_holder")
local lib = require("neotest.lib")
local timer = require("neotest-java.util.timer")
local nio = require("nio")

local detect_project_type = require("neotest-java.util.detect_project_type")

Expand Down Expand Up @@ -114,7 +115,7 @@ end

-- create data directory if it doesn't exist
local data_dir = vim.fn.stdpath("data") .. "/neotest-java"
os.execute("mkdir -p " .. data_dir)
vim.uv.fs_mkdir(data_dir, 493)
end)()

setmetatable(NeotestJavaAdapter, {
Expand Down