-
Notifications
You must be signed in to change notification settings - Fork 5
Element is not defined #32
Comments
We definitely need to get some better documentation for this. But I think one issue is here: class TodoMVCPage extends Interactor { The correct way to use the helpers @interactor class TodoMVCPage { But the other issue I see is with Or maybe there is something weird with the UMD module, and we need to explicitly use |
hmm. I'm running the tests from the cli, so.. I don't know if Element would exist or not? I know in typescript, there is an HTMLElement |
It's not really the preprocessor (typescript) that would determine this, but the environment in which your code is run. This package is meant to be consumed in a browser environment, where the DOM API is fully available. You mention the CLI, so I'm inclined to think you may be using JSDom or some other environment that simulates the DOM. If that's the case, then this may be an issue with that library properly mocking the |
Oh, I'm not currently using jsdom, that much be the issue, I'll add that.
It bothers me how many disjoint parts this all requires
…On Sun, Jun 10, 2018, 6:17 PM Wil Wilsman ***@***.***> wrote:
HTMLElement extends Element (MDN Docs
<https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement>), so I'm
still unsure of why you get an Element is not defined error.
It's not really the preprocessor (typescript) that would determine this,
but the environment in which your code is run. This package is meant to be
consumed in a browser environment, where the DOM API is fully available.
You mention the CLI, so I'm inclined to think you may be using JSDom or
some other environment that *simulates* the DOM. If that's the case, then
this may be an issue with that library properly mocking the Element class.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMJanLAyjIv3d-BOxKvhbJw1__sFMUpks5t7ZrfgaJpZM4Uh3cs>
.
|
j/k, I have jsdom, doing this in my setup file:
|
the tree at the commit: https://github.com/NullVoxPopuli/react-vs-ember/tree/adcdbab76a44508d6c9e9c0b85cb8d3c06de3b75 |
Ah yea, we built BigTest specifically to get away from jsdom since it's a faked environment (not a real browser). We're working on getting guides up @wwilsman has a blog post that will be out in the next few days (in review! :D) so this will be explained better soon. You'll need something like Karma to launch a browser. I'm looking at the repo you linked to and I'm not 100% sure how to integrate Karma with Parcel yet. I'll have to get back to you on that. Also, dope repo! 😁 |
yay!!
that'd be cool. but, but why does anything need to know about parcel / webpack / etc? why not just use ts-node directly to evaluate the test files?
Thanks!! :-D |
This is eventually what we want but I think we might have to write our own runner like Karma. We use Karma because it runs the app in an iframe (isolated) and handles launching browsers for us. So it has to know about the build tool because that's how Karma works. It handles bundling all the test files for you |
@Robdel12 are there any apps that have everything bigtestjs already setup that I can look up in the mean time? want to see if I can just figure it out based on something that's already working. |
Yea no problem! One of our client apps is 100% open source and uses BigTest: https://github.com/folio-org/ui-eholdings/tree/master/tests but that might be harder to follow since Stripes-CLI abstracts the karma/webpack config out. Here's an example I did with spectacle: https://github.com/Robdel12/spectacle-boilerplate/commit/66e14b0197625e7d82109c53aa221d468dcc4daa You'll want to ignore some parts that |
so, I aalllmost have karma working with typescript and a test-only webpack config. :- |
Hey @NullVoxPopuli just want to let you know we're taking a look at the repo you've linked. I think there's some funky things going on with Karma & typescript. We haven't ever used typescript so this is going to be a little bit of a learning experience. |
it's all good. I think, using the master branch, webpack can handle everything, rather than karma-typescript. |
I got things working. I have a test-only webpack file that I'm running everything though. |
Hm, I'm wondering what could be an actionable takeaway from this? The obvious is we need to step up our docs / guide game. |
I think the issue was that karma-typescript doesn't work, and that using webpack for typescript transpiling is the way to go. |
and then I get this error:
The text was updated successfully, but these errors were encountered: