• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FourierTransformer / tested / 26137758217

20 May 2026 02:35AM UTC coverage: 82.364%. Remained the same
26137758217

push

github

web-flow
Merge 1c13d288e into 462bd706b

164 of 169 new or added lines in 6 files covered. (97.04%)

58 existing lines in 3 files now uncovered.

1331 of 1616 relevant lines covered (82.36%)

3342.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.67
/build/tested/test_runner.lua
1
local ThreadPool = require("tested.libs.ThreadPool")
12✔
2
local lanes = require("lanes")
12✔
3
local logging = require("tested.libs.logging")
12✔
4

5

6
local logger = logging.get_logger("tested.test_runner")
12✔
7

8
local test_runner = {}
12✔
9

10
function test_runner.run_with_cleanup(file_loader, test_file, options)
12✔
11

12
   logger:info("%s: keeping track of pre-loaded packages", test_file)
156✔
13
   local pre_test_loaded_packages = {}
156✔
14
   for package_name, _ in pairs(package.loaded) do pre_test_loaded_packages[package_name] = true end
5,811✔
15

16
   local test_module = file_loader.load_file(test_file)
156✔
17
   if not (type(test_module) == "table" and type(test_module.tests) == "table" and type(test_module.run_only_tests) == "boolean") then
156✔
UNCOV
18
      error(test_file .. ": does not 'return tested' at end of file - unable to run tests", 0)
×
19
   end
20

21
   local test_results = test_module:run(test_file, options)
156✔
22

23
   logger:info("%s: Clearing out any packages that were loaded", test_file)
156✔
24
   for package_name, _ in pairs(package.loaded) do
6,282✔
25
      if not pre_test_loaded_packages[package_name] then
6,126✔
26
         logger:debug("%s: Clearing out package: %s", test_file, package_name)
471✔
27
         package.loaded[package_name] = nil
471✔
28
      end
29
   end
30
   collectgarbage()
156✔
31

32
   return test_results
156✔
33

34
end
35

36
function test_runner.run_tests(
12✔
37
   test_files,
38
   options)
39

40

41
   local file_loader = require("tested.file_loader")
12✔
42
   for _, setup in ipairs(file_loader.setups) do setup() end
27✔
43

44
   local luacov_loaded, luacov_runner = pcall(require, "luacov.runner")
12✔
45
   if options and options.coverage and not luacov_loaded then
12✔
UNCOV
46
      error("Code coverage requires the luacov module to be installed")
×
47
   end
48

49
   local output = {
12✔
50
      total_time = 0,
9✔
51
      total_tests = 0,
9✔
52
      all_fully_tested = true,
9✔
53
      total_counts = { passed = 0, failed = 0, expected = 0, skipped = 0, filtered = 0, invalid = 0 },
12✔
54
      module_results = {},
12✔
55
   }
56
   local coverage_results = {}
12✔
57

58
   local i = 0
12✔
59

60
   if options.coverage then
12✔
UNCOV
61
      logger:info("Initializing luacov")
×
62
      luacov_runner.init({ exclude = { "luarocks%/.+$", "tested%/.+$", "tested$" } })
×
63
      luacov_runner.pause()
×
64
   end
65

66
   return function()
67
      i = i + 1
168✔
68
      if i > #test_files then
168✔
69
         if options.coverage then luacov_runner.shutdown() end
12✔
70
         return nil, output
12✔
71
      end
72

73
      local coverage = {}
156✔
74

75
      if options.coverage then luacov_runner.resume() end
156✔
76
      local test_output = test_runner.run_with_cleanup(file_loader, test_files[i], options)
156✔
77
      if options.coverage then
156✔
UNCOV
78
         coverage = luacov_runner.data
×
79
         luacov_runner.resume()
×
80
      end
81

82
      output.module_results[i] = test_output
156✔
83
      coverage_results[i] = coverage
156✔
84

85
      if test_output.fully_tested == false then output.all_fully_tested = false end
156✔
86
      output.total_counts.passed = output.total_counts.passed + test_output.counts.passed
156✔
87
      output.total_counts.failed = output.total_counts.failed + test_output.counts.failed
156✔
88
      output.total_counts.expected = output.total_counts.expected + test_output.counts.expected
156✔
89
      output.total_counts.skipped = output.total_counts.skipped + test_output.counts.skipped
156✔
90
      output.total_counts.filtered = output.total_counts.filtered + test_output.counts.filtered
156✔
91
      output.total_counts.invalid = output.total_counts.invalid + test_output.counts.invalid
156✔
92
      output.total_time = output.total_time + test_output.total_time
156✔
93
      output.total_tests = output.total_tests + #test_output.tests
156✔
94

95
      return test_output, output
156✔
96
   end
97

98
end
99

100
local function load_and_run_test(test_file, options)
101

102

103

104

105

UNCOV
106
   local file_loader = require("tested.file_loader")
×
107
   return test_runner.run_with_cleanup(file_loader, test_file, options)
×
108
end
109

110
local function run_parallel_tests(
111
   test_files,
112
   num_threads,
113
   options,
114
   display_func)
115

116

117

NEW
118
   options.clock_s = lanes.now_secs
×
NEW
119
   options.sleep_s = lanes.sleep
×
120

UNCOV
121
   local output = {
×
122
      total_time = 0,
123
      total_tests = 0,
124
      all_fully_tested = true,
125
      total_counts = { passed = 0, failed = 0, expected = 0, skipped = 0, filtered = 0, invalid = 0 },
126
      module_results = {},
127
   }
UNCOV
128
   local coverage_results = {}
×
129

UNCOV
130
   local pool = ThreadPool.init(num_threads, options.coverage, options.language_handlers)
×
UNCOV
131
   local input = {}
×
UNCOV
132
   for i = 1, #test_files do
×
133
      input[i] = { test_files[i], options }
×
134
   end
135

136
   local map_results = pool:map(load_and_run_test, input, display_func)
×
137
   for i, map_result in ipairs(map_results) do
×
138
      output.module_results[i] = map_result.result
×
UNCOV
139
      coverage_results[i] = map_result.code_coverage
×
140
   end
141
   pool:shutdown()
×
142

143

144

145

146
   if options.coverage then
×
147

148

UNCOV
149
      local luacov = require("luacov.runner")
×
UNCOV
150
      luacov.data = {}
×
151
      luacov.configuration = { statsfile = "luacov.stats.out" }
×
152

UNCOV
153
      for _, stats in ipairs(coverage_results) do
×
154
         for name, file_data in pairs(stats) do
×
155
            if luacov.data[name] then
×
156
               luacov.update_stats(luacov.data[name], file_data)
×
157
            else
158
               luacov.data[name] = file_data
×
159
            end
160
         end
161
      end
UNCOV
162
      luacov.save_stats()
×
163
   end
164

UNCOV
165
   for _, test_output in ipairs(output.module_results) do
×
UNCOV
166
      if test_output.fully_tested == false then output.all_fully_tested = false end
×
167
      output.total_counts.passed = output.total_counts.passed + test_output.counts.passed
×
UNCOV
168
      output.total_counts.failed = output.total_counts.failed + test_output.counts.failed
×
UNCOV
169
      output.total_counts.expected = output.total_counts.expected + test_output.counts.expected
×
170
      output.total_counts.skipped = output.total_counts.skipped + test_output.counts.skipped
×
171
      output.total_counts.filtered = output.total_counts.filtered + test_output.counts.filtered
×
172
      output.total_counts.invalid = output.total_counts.invalid + test_output.counts.invalid
×
173
      output.total_time = output.total_time + test_output.total_time
×
174
      output.total_tests = output.total_tests + #test_output.tests
×
175
   end
176

177
   return output
×
178
end
179

180
return { test_runner, run_parallel_tests }
12✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc