In this fiddle, I'm writing some test cases and trying to capture results of those test cases in an object, so that I can print the results on the page the way I want. I'm basically trying to recreate coding challenges in freecodecamp.
When done correctly, I should be able to pass in any test suite I want so that developers can later write code to pass those test suites.
Right now, to get the jasmine spec descriptions and results, I do this
var env = jasmine.getEnv();
env.execute();
var specResults = env.currentSpec.suite.specs_;
When I console-log specResults, I have properties failedCount and passedCount deep inside it, that lets me identify whether a spec has passed or failed. However when I reuse the same object by copying it inside another object, they have incorrect values.
In this particular example, specsArray[2].passed is supposed to be false because specResults[2].results.failedCount is not equal to 0. But it's true. Why?