aurelia / testing

Simplifies the testing of UI components by providing an elegant, fluent interface for arranging test setups along with a number of runtime debug/test helpers.
MIT License
40 stars 27 forks source link

waitForElement throws in context of pal-nodejs #83

Closed Alexander-Taran closed 6 years ago

Alexander-Taran commented 6 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: https://github.com/aurelia/testing/blob/b0fb939fa40f1067ac72d84c7775088f8b8068a6/src/wait.ts#L27 When tests are run with jest there is no instanceof NodeList. It is though under global.window, not under global though. So even though the element is successfully found by waitForElement - it is not returned.

I'm not sure what would the correct fix be for this one. If wait should use PAL.global.window.NodeList of Pal Nodejs should somehow globalize NodeList.

Would be happy to provide a PR with a bit of guidance on this one

a bit of previous discussion here: https://github.com/aurelia/cli/issues/822

a workaround i found is to change the line to var found = element !== null && (!(element instanceof global.window.NodeList) && in dist/commonjs/wait.js (depends on module system in use, I guess)

Alexander-Taran commented 6 years ago

Figured it'd be more logical to augment pal-nodejs