-
Notifications
You must be signed in to change notification settings - Fork 70
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 more helper runner helper methods #421
base: main
Are you sure you want to change the base?
Conversation
}; | ||
frame.src = `${suite.url}`; | ||
frame.onload = () => resolve(); | ||
frame.onerror = () => reject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
it("should call prepare on all suites", () => { | ||
for (const suite in runner.suites) | ||
suite.prepare.calledOnce(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this is working. I think calledOnce
is a property on a spy, not a function?
You probably wanted assert.calledOnce(suite.prepare)
. This makes me wonder if we really execute this line.
Debugging further it looks like indeed runner.suites
is undefined, that's why the test passes (the for loop never runs anything). For loops are dangerous in tests :-)
I think you wanted _suites
, not suites
(also above in the before
). I tried this but then I get more errors, so I'll let you debug :-D
Also it would be good to add something such as expect(runner._suites).not.to.have.length(0)
to make sure we enter the loop.
// seed. This is not a high quality RNG, but it's plenty good enough. | ||
for (let i = 0; i < suites.length - 1; i++) { | ||
let j = i + (this._suiteOrderRandomNumberGenerator() % (suites.length - i)); | ||
let tmp = suites[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use const maybe?
Refactor the runner a bit to be more flexible for upcoming experimental PRs.