Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Latest v1.18.x Mocha #175

Closed
metaskills opened this issue Apr 13, 2014 · 7 comments
Closed

Use Latest v1.18.x Mocha #175

metaskills opened this issue Apr 13, 2014 · 7 comments

Comments

@metaskills
Copy link

I opened this issue on Chai.js' issue system.

chaijs/chai#255

Once they update, I'd like to consider updating Konacha too. Really looking forward to using the new promise features baked into Mocha core now.

@jfirebaugh
Copy link
Owner

Took a quick look at this but it leads to some test failures. Does any collaborator want to have a go?

@damianmr
Copy link

What sort of failures are you talking about? I need to use the promises features, does anyone have a clue on how to update the version of Mocha?

@outdooricon
Copy link
Collaborator

I'm making progress on this issue here: https://github.com/outdooricon/konacha/tree/mocha_2.2.5. Working on moving towards 2.2.5. I have it down to only erring in runner_spec now...

@outdooricon
Copy link
Collaborator

Would love some additional help... the runner_spec feels a little over my head. It looks like Mocha is now much more verbose than what the test runner is expecting. Here's the error output:

1) Konacha::Runner with selenium behaves like Konacha::Runner #run passes along the right events
     Failure/Error: subject.reporter.should_receive(:process_mocha_event).with(failure)
       #<Konacha::Reporter:0x000001091c7b90> received :process_mocha_event with unexpected arguments
         expected: ({"event"=>"fail", "type"=>"test", "data"=>{"title"=>"fails", "fullTitle"=>"failure fails", "parentFullTitle"=>"failure", "status"=>"failed", "path"=>"failing_spec.js", "error"=>{"message"=>"expected 4 to equal 5", "name"=>"AssertionError"}}})
              got: ({"event"=>"suite", "data"=>{"title"=>"spec file isolation (A)", "fullTitle"=>"spec file isolation (A)", "path"=>"isolation/a_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (A) isolates globals in one spec file from those of other spec files", "parentFullTitle"=>"spec file isolation (A)", "path"=>"isolation/a_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (A) isolates globals in one spec file from those of other spec files", "duration"=>1, "parentFullTitle"=>"spec file isolation (A)", "status"=>"passed", "path"=>"isolation/a_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"spec file isolation (A)", "fullTitle"=>"spec file isolation (A)", "path"=>"isolation/a_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"spec file isolation (B)", "fullTitle"=>"spec file isolation (B)", "path"=>"isolation/b_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (B) isolates globals in one spec file from those of other spec files", "parentFullTitle"=>"spec file isolation (B)", "path"=>"isolation/b_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (B) isolates globals in one spec file from those of other spec files", "duration"=>1, "parentFullTitle"=>"spec file isolation (B)", "status"=>"passed", "path"=>"isolation/b_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"spec file isolation (B)", "fullTitle"=>"spec file isolation (B)", "path"=>"isolation/b_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"jQuery.fn.plugin()", "fullTitle"=>"jQuery.fn.plugin()", "path"=>"jquery.plugin_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"is a fake test to assert that the suite has loaded into the iframe", "fullTitle"=>"jQuery.fn.plugin() is a fake test to assert that the suite has loaded into the iframe", "parentFullTitle"=>"jQuery.fn.plugin()", "path"=>"jquery.plugin_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"is a fake test to assert that the suite has loaded into the iframe", "fullTitle"=>"jQuery.fn.plugin() is a fake test to assert that the suite has loaded into the iframe", "duration"=>0, "parentFullTitle"=>"jQuery.fn.plugin()", "status"=>"passed", "path"=>"jquery.plugin_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"jQuery.fn.plugin()", "fullTitle"=>"jQuery.fn.plugin()", "path"=>"jquery.plugin_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"pending test", "fullTitle"=>"pending test", "path"=>"pending_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"pending test", "fullTitle"=>"pending test", "path"=>"pending_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"two_plus_two", "fullTitle"=>"two_plus_two", "path"=>"spec_helper_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"equals four", "fullTitle"=>"two_plus_two equals four", "parentFullTitle"=>"two_plus_two", "path"=>"spec_helper_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"equals four", "fullTitle"=>"two_plus_two equals four", "duration"=>0, "parentFullTitle"=>"two_plus_two", "status"=>"passed", "path"=>"spec_helper_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"two_plus_two", "fullTitle"=>"two_plus_two", "path"=>"spec_helper_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"spec in subdirectory", "fullTitle"=>"spec in subdirectory", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"passes", "fullTitle"=>"spec in subdirectory passes", "parentFullTitle"=>"spec in subdirectory", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"passes", "fullTitle"=>"spec in subdirectory passes", "duration"=>0, "parentFullTitle"=>"spec in subdirectory", "status"=>"passed", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"spec in subdirectory", "fullTitle"=>"spec in subdirectory", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"templating", "fullTitle"=>"templating", "path"=>"templating_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"is built in to Sprockets", "fullTitle"=>"templating is built in to Sprockets", "parentFullTitle"=>"templating", "path"=>"templating_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"is built in to Sprockets", "fullTitle"=>"templating is built in to Sprockets", "duration"=>1, "parentFullTitle"=>"templating", "status"=>"passed", "path"=>"templating_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"templating", "fullTitle"=>"templating", "path"=>"templating_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"UI", "fullTitle"=>"UI", "path"=>"ui_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"supports alternate mocha UIs", "fullTitle"=>"UI supports alternate mocha UIs", "parentFullTitle"=>"UI", "path"=>"ui_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"supports alternate mocha UIs", "fullTitle"=>"UI supports alternate mocha UIs", "duration"=>1, "parentFullTitle"=>"UI", "status"=>"passed", "path"=>"ui_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"UI", "fullTitle"=>"UI", "path"=>"ui_spec.js"}, "type"=>"suite"}) (1 time)
     Shared Example Group: "Konacha::Runner" called from ./spec/runner_spec.rb:159
     # ./spec/runner_spec.rb:137:in `block (4 levels) in <top (required)>'

  2) Konacha::Runner with poltergeist behaves like Konacha::Runner #run passes along the right events
     Failure/Error: subject.reporter.should_receive(:process_mocha_event).with(failure)
       #<Konacha::Reporter:0x00000103977210> received :process_mocha_event with unexpected arguments
         expected: ({"event"=>"fail", "type"=>"test", "data"=>{"title"=>"fails", "fullTitle"=>"failure fails", "parentFullTitle"=>"failure", "status"=>"failed", "path"=>"failing_spec.js", "error"=>{"message"=>"expected 4 to equal 5", "name"=>"AssertionError"}}})
              got: ({"event"=>"suite", "data"=>{"title"=>"spec file isolation (A)", "fullTitle"=>"spec file isolation (A)", "path"=>"isolation/a_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (A) isolates globals in one spec file from those of other spec files", "parentFullTitle"=>"spec file isolation (A)", "path"=>"isolation/a_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (A) isolates globals in one spec file from those of other spec files", "duration"=>0, "parentFullTitle"=>"spec file isolation (A)", "status"=>"passed", "path"=>"isolation/a_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"spec file isolation (A)", "fullTitle"=>"spec file isolation (A)", "path"=>"isolation/a_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"spec file isolation (B)", "fullTitle"=>"spec file isolation (B)", "path"=>"isolation/b_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (B) isolates globals in one spec file from those of other spec files", "parentFullTitle"=>"spec file isolation (B)", "path"=>"isolation/b_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"isolates globals in one spec file from those of other spec files", "fullTitle"=>"spec file isolation (B) isolates globals in one spec file from those of other spec files", "duration"=>0, "parentFullTitle"=>"spec file isolation (B)", "status"=>"passed", "path"=>"isolation/b_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"spec file isolation (B)", "fullTitle"=>"spec file isolation (B)", "path"=>"isolation/b_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"jQuery.fn.plugin()", "fullTitle"=>"jQuery.fn.plugin()", "path"=>"jquery.plugin_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"is a fake test to assert that the suite has loaded into the iframe", "fullTitle"=>"jQuery.fn.plugin() is a fake test to assert that the suite has loaded into the iframe", "parentFullTitle"=>"jQuery.fn.plugin()", "path"=>"jquery.plugin_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"is a fake test to assert that the suite has loaded into the iframe", "fullTitle"=>"jQuery.fn.plugin() is a fake test to assert that the suite has loaded into the iframe", "duration"=>0, "parentFullTitle"=>"jQuery.fn.plugin()", "status"=>"passed", "path"=>"jquery.plugin_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"jQuery.fn.plugin()", "fullTitle"=>"jQuery.fn.plugin()", "path"=>"jquery.plugin_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"pending test", "fullTitle"=>"pending test", "path"=>"pending_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"pending test", "fullTitle"=>"pending test", "path"=>"pending_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"two_plus_two", "fullTitle"=>"two_plus_two", "path"=>"spec_helper_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"equals four", "fullTitle"=>"two_plus_two equals four", "parentFullTitle"=>"two_plus_two", "path"=>"spec_helper_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"equals four", "fullTitle"=>"two_plus_two equals four", "duration"=>1, "parentFullTitle"=>"two_plus_two", "status"=>"passed", "path"=>"spec_helper_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"two_plus_two", "fullTitle"=>"two_plus_two", "path"=>"spec_helper_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"spec in subdirectory", "fullTitle"=>"spec in subdirectory", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"passes", "fullTitle"=>"spec in subdirectory passes", "parentFullTitle"=>"spec in subdirectory", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"passes", "fullTitle"=>"spec in subdirectory passes", "duration"=>1, "parentFullTitle"=>"spec in subdirectory", "status"=>"passed", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"spec in subdirectory", "fullTitle"=>"spec in subdirectory", "path"=>"subdirectory/subdirectory_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"templating", "fullTitle"=>"templating", "path"=>"templating_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"is built in to Sprockets", "fullTitle"=>"templating is built in to Sprockets", "parentFullTitle"=>"templating", "path"=>"templating_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"is built in to Sprockets", "fullTitle"=>"templating is built in to Sprockets", "duration"=>3, "parentFullTitle"=>"templating", "status"=>"passed", "path"=>"templating_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"templating", "fullTitle"=>"templating", "path"=>"templating_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"suite", "data"=>{"title"=>"UI", "fullTitle"=>"UI", "path"=>"ui_spec.js"}, "type"=>"suite"}) (1 time)
                   ({"event"=>"test", "data"=>{"title"=>"supports alternate mocha UIs", "fullTitle"=>"UI supports alternate mocha UIs", "parentFullTitle"=>"UI", "path"=>"ui_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"pass", "data"=>{"title"=>"supports alternate mocha UIs", "fullTitle"=>"UI supports alternate mocha UIs", "duration"=>1, "parentFullTitle"=>"UI", "status"=>"passed", "path"=>"ui_spec.js"}, "type"=>"test"}) (1 time)
                   ({"event"=>"suite end", "data"=>{"title"=>"UI", "fullTitle"=>"UI", "path"=>"ui_spec.js"}, "type"=>"suite"}) (1 time)
     Shared Example Group: "Konacha::Runner" called from ./spec/runner_spec.rb:163
     # ./spec/runner_spec.rb:137:in `block (4 levels) in <top (required)>'

@outdooricon
Copy link
Collaborator

I've now got runner_spec to just erring for subject.reporter.should_receive(:process_mocha_event).with(failure) . It appears that Mocha is not allowing the AssertionError from failing_spec.js's first test to perform normally. Instead it gets picked up by Mocha's new fail catcher (see https://github.com/mochajs/mocha/blob/master/lib/runner.js#L205) and outputs it differently now in konacha's browser runner:
screen shot 2015-06-18 at 4 07 12 pm
This is really the extent of what I can do, someone needs to pick this up and take it the rest of the way. Any there any maintainers willing to take this @jfirebaugh?

@outdooricon
Copy link
Collaborator

Ok, it's because Mocha is testing for instanceof Error now in fail. Since Konacha uses iframes, the instanceof check on chai assertions fails. When mochajs/mocha#1758 is merged, then we should be good to go.

@outdooricon
Copy link
Collaborator

Mocha finally released with my fix. This issue will now be solved in #211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants