Spec Not Showing Results and Throwing Exceptions--Solved

Sharing in case someone else stumbles across this. Figured this out while drafting this. My problem was this spec file only had “describe” blocks. The test suite wants the tests to be in “it” blocks.

I’ve got a test suite going for a project that has 13 and counting _spec.cr files. One of the files seems to be behaving badly. Its tests are not reported in the spec run summary and any failures raise exceptions rather than reporting a failure. Passing output looks like this:

crystal spec --tag “WIP”

Finished in 222.88 milliseconds
0 examples, 0 failures, 0 errors, 0 pending

While failure is:

crystal spec --tag “WIP”
Unhandled exception: Expected: 2
got: 3 (Spec::AssertionFailed)
from C:\Program Files\Crystal\src\spec\methods.cr:82 in ‘fail’
from C:\Program Files\Crystal\src\spec\expectations.cr:470 in ‘should’
from spec\artifacttypes_spec.cr:34 in ‘->’
from C:\Program Files\Crystal\src\spec\context.cr:286 in ‘describe’
from C:\Program Files\Crystal\src\spec\methods.cr:20 in ‘describe’
from spec\artifacttypes_spec.cr:7 in ‘->’
from C:\Program Files\Crystal\src\spec\context.cr:286 in ‘describe’
from C:\Program Files\Crystal\src\spec\methods.cr:20 in ‘describe:tags’
from spec\artifact_spec.cr:5 in ‘__crystal_main’
from C:\Program Files\Crystal\src\crystal\main.cr:129 in ‘main_user_code’
from C:\Program Files\Crystal\src\crystal\main.cr:115 in ‘main’
from C:\Program Files\Crystal\src\crystal\main.cr:141 in ‘main’
from C:\Program Files\Crystal\src\crystal\system\win32\wmain.cr:36 in ‘wmain’
from D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in ‘__scrt_common_main_seh’
from C:\WINDOWS\System32\KERNEL32.DLL +75165 in ‘BaseThreadInitThunk’
from C:\WINDOWS\SYSTEM32\ntdll.dll +372536 in ‘RtlUserThreadStart’

Looking at the file, it doesn’t seem any different than the others that work.