waterlink / spec2.cr

Enhanced `spec` testing library for [Crystal](http://crystal-lang.org/).
MIT License
103 stars 22 forks source link

spec2.cr isn't always executing (all) specs #55

Open alexanderadam opened 7 years ago

alexanderadam commented 7 years ago

I don't have an example yet and I still have problems with macros and the codebase. I will post more information if I know more.

At the moment I have a project where no specs are executed with $ crystal spec.

The console output is always empty.

Finished in 2.99 milliseconds
Examples: 0, failures: 0, pending: 0

If I add the path to a spec explicitly it is running.

So far I didn't found much. I saw that full_name always contained everything, so the error comes at a later point.

Maybe it's a naming thing? I will keep you updated. I would appreciate it if you have an idea / fix / hint.

Edit: It seems that run_context is entered just once and it's given context has blank @what, blank @description and @_examples is nil. So it looks like this:


run_context(
  #<Spec2::Reporters::Default:0x55ece4158ed0 @count=0, @pending=0, @errors=[], @output=#<Spec2::Outputs::Default:0x55ece4152fc0>>,
  #<Spec2::Orders::Default:0x55ece4152fd0>,
  #<Spec2::Context:0x55ece4156d40 @what="", @description="", @_contexts=nil, @_examples=nil, @_global_befores=[#<Proc(Nil):0x55ece1d698f0>]>)
alexanderadam commented 7 years ago

hm, okay I give up. 😞 @waterlink, do you have any idea how I could debug 🐛 this?

waterlink commented 7 years ago

Can you send a code example? Ideally minimised?

alexanderadam commented 7 years ago

No 😢 I will try to provide some in the following week.

c910335 commented 7 years ago

It seems if an exception is accidentally raised outside it, specs after that will not be executed without any errors.

require "spec2"

Spec2.describe "Foo" do
  it "is foo~~~" do
    expect("foo~~~").to eq "foo~~~"
  end
end

raise "foo"

Spec2.describe "Boo" do
  it "is boo~~~" do
    expect("boo~~~").to eq "boo~~~"
  end
end
$ crystal spec
.

Finished in 0.31 milliseconds
Examples: 1, failures: 0, pending: 0