From a6351e49a4263431c09ba8d666fb6def2df9a653 Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Wed, 16 Nov 2022 22:43:19 +0300 Subject: [PATCH] Add test for skipped --- specs/utils_spec.lua | 53 ++++++++++++++++++++++++++++++++++++++ tests/Feature/UserTest.php | 1 + 2 files changed, 54 insertions(+) diff --git a/specs/utils_spec.lua b/specs/utils_spec.lua index 655fa2d..94d7c6e 100644 --- a/specs/utils_spec.lua +++ b/specs/utils_spec.lua @@ -400,4 +400,57 @@ describe("get_test_results", function() assert.are.same(utils.get_test_results(xml_output, output_file), expected) end) + + it('parses output with skipped tests', function() + local xml_output = { + testsuites = { + testsuite = { + _attr = { + assertions = "0", + errors = "0", + failures = "0", + name = "", + skipped = "1", + tests = "1", + time = "0.001544", + warnings = "0" + }, + testsuite = { + _attr = { + assertions = "0", + errors = "0", + failures = "0", + file = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php", + name = "P\\Tests\\Feature\\UserTest", + skipped = "1", + tests = "1", + time = "0.001544", + warnings = "0" + }, + testcase = { + _attr = { + assertions = "0", + class = "Tests\\Feature\\UserTest", + classname = "Tests.Feature.UserTest", + file = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php", + name = "tellName", + time = "0.001544" + }, + skipped = {} + } + } + } + } + } + + local expected = { + ["/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php::tellName"] = { + output_file = output_file, + short = "TESTS.FEATURE.USERTEST\n-> PASSED - tellName", + status = "passed" + } + } + + assert.are.same(utils.get_test_results(xml_output, output_file), expected) + end) end) diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index c70602a..773b697 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -25,6 +25,7 @@ test('tellName', function () { expect($this->sut) ->tellName()->toBeString()->toContain('John'); }) + ->skip() ->group('special tests'); it('can tellAge')