-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcbsh
executable file
·39 lines (31 loc) · 1.04 KB
/
cbsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env lua
package.path = './?.lua;' .. package.path
pcall(require, 'luarocks.require')
require 'telescope'
require 'calabash'
require 'lfs'
local steps = calabash.load_steps('features/steps.lua')
local contexts = {}
for filename in lfs.dir('features') do
if string.match(filename, '.*%.feature') then
local feature_str = io.open('features/' .. filename):read('*all')
calabash.generate_contexts(feature_str, steps, contexts)
end
end
local buffer = {}
local results = telescope.run(contexts, callbacks, test_pattern)
local summary, data = telescope.summary_report(contexts, results)
table.insert(buffer, telescope.test_report(contexts, results))
table.insert(buffer, summary)
local report = telescope.error_report(contexts, results)
if report then
table.insert(buffer, "")
table.insert(buffer, report)
end
if #buffer > 0 then print(table.concat(buffer, "\n")) end
for _, v in pairs(results) do
if v.status_code == telescope.status_codes.err or
v.status_code == telescope.status_codes.fail then
os.exit(1)
end
end