qunitjs / js-reporters

📋 Common Reporter Interface (CRI) for JavaScript testing frameworks.
MIT License
60 stars 18 forks source link

Break Suite and Test into SuiteStart/SuiteEnd and TestStart/TestEnd #92

Closed flore77 closed 8 years ago

flore77 commented 8 years ago

Fixes #91.

flore77 commented 8 years ago

@jzaefferer what do you think so far?

Also if we will add helper functions like createSuiteStart etc., we will simplify the code in the adapters, more exactly in JasmineAdatper and QunitAdapter.

jzaefferer commented 8 years ago

Looks good! Can you update the spec as well?

jzaefferer commented 8 years ago

Spec update also looks good!

flore77 commented 8 years ago

I don't know what to do exactly with the errors and assertions arrays, there will be the same arrays also in the new created object, and slice wouldn't work because there are objects, Assertions objects. Would it be fine to leave them like they currently are ?

jzaefferer commented 8 years ago

there will be the same arrays also in the new created object

Could you clarify this? I don't follow.

flore77 commented 8 years ago

There will be no copies of those arrays, currently it will be the same array.

var errors = [];
var t = new Test():

t.errors = errors;

t.errors will point to the same array, this can be changed through:

t.errors = errors.slice();

It will be another array, but sine in the array are objects, in the new created array will be the same objects and if some modifies t.errors it will also reflect in the original errors array.

And I am not sure how to handle this.

jzaefferer commented 8 years ago

Okay, though I still don't understand the context where this is a problem. As long as TestStart doesn't have assertions and errors, the array should exist on TestEnd, right?

flore77 commented 8 years ago

Yes, there exists only on TestEnd. The problem would be if someone changes something, it would reflect also in our internal data structures. So the createTestEnd function does not create a completely new object and I don't know if this is fine or no.

jzaefferer commented 8 years ago

That seems fine to me.

flore77 commented 8 years ago

Alright, then please review :smiley:

flore77 commented 8 years ago

Finished changes.