From 9f00925a3d5e70350ad73d908d99c8ef634dc7eb Mon Sep 17 00:00:00 2001 From: George Roman Date: Sun, 10 Jun 2018 23:41:32 +0300 Subject: Fix the collecting of coverage data from unit tests --- spec/dir_spec.lua | 12 ++++++++++++ spec/fetch_spec.lua | 3 ++- spec/fs_spec.lua | 3 ++- spec/fun_spec.lua | 1 + spec/persist_spec.lua | 1 + spec/util_spec.lua | 1 + 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/spec/dir_spec.lua b/spec/dir_spec.lua index 27966777..08fb6e23 100644 --- a/spec/dir_spec.lua +++ b/spec/dir_spec.lua @@ -1,10 +1,22 @@ local test_env = require("spec.util.test_env") +local testing_paths = test_env.testing_paths test_env.unload_luarocks() test_env.setup_specs() local dir = require("luarocks.dir") describe("Luarocks dir test #unit", function() + local runner + + setup(function() + runner = require("luacov.runner") + runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true + end) + + teardown(function() + runner.shutdown() + end) describe("dir.is_basic_protocol", function() it("checks whether the arguments represent a valid protocol and returns the result of the check", function() diff --git a/spec/fetch_spec.lua b/spec/fetch_spec.lua index aa107970..3564bffe 100644 --- a/spec/fetch_spec.lua +++ b/spec/fetch_spec.lua @@ -9,7 +9,7 @@ local lfs = require("lfs") local testing_paths = test_env.testing_paths local get_tmp_path = test_env.get_tmp_path -describe("Luarocks fetch test #unit", function() +describe("Luarocks fetch test #unit", function() local are_same_files = function(file1, file2) return file1 == file2 or lfs.attributes(file1).ino == lfs.attributes(file2).ino end @@ -19,6 +19,7 @@ describe("Luarocks fetch test #unit", function() setup(function() runner = require("luacov.runner") runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true end) teardown(function() diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua index e09ac6df..f1529c39 100644 --- a/spec/fs_spec.lua +++ b/spec/fs_spec.lua @@ -9,7 +9,7 @@ local posix_ok = pcall(require, "posix") local testing_paths = test_env.testing_paths local get_tmp_path = test_env.get_tmp_path -describe("Luarocks fs test #unit", function() +describe("Luarocks fs test #unit", function() local exists_file = function(path) local ok, err, code = os.rename(path, path) if not ok and code == 13 then @@ -56,6 +56,7 @@ describe("Luarocks fs test #unit", function() setup(function() runner = require("luacov.runner") runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true end) teardown(function() diff --git a/spec/fun_spec.lua b/spec/fun_spec.lua index b0a082ac..fe945921 100644 --- a/spec/fun_spec.lua +++ b/spec/fun_spec.lua @@ -10,6 +10,7 @@ describe("LuaRocks fun tests #unit", function() setup(function() runner = require("luacov.runner") runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true end) teardown(function() diff --git a/spec/persist_spec.lua b/spec/persist_spec.lua index 339147b1..dccb0ec4 100644 --- a/spec/persist_spec.lua +++ b/spec/persist_spec.lua @@ -10,6 +10,7 @@ describe("Luarocks persist test #unit", function() setup(function() runner = require("luacov.runner") runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true end) teardown(function() diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 3bb97a5b..26e93e14 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua @@ -79,6 +79,7 @@ describe("Luarocks util test #unit", function() setup(function() runner = require("luacov.runner") runner.init(testing_paths.testrun_dir .. "/luacov.config") + runner.tick = true end) teardown(function() -- cgit v1.2.3-55-g6feb