-
Notifications
You must be signed in to change notification settings - Fork 31
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
Doesn't work if test name contains $ #17
Comments
That's strange. I'm gonna try to debug this and tell you exactly where it breaks for me. I'm using expect.js (now under jest governance) but this shouldn't matter, right? When I change |
Right. And I just checked, it still works for me when I use expect.js. |
Yes.
When I change the name, test becomes green as on your screen. |
You could try setting |
Apologies, the flaw was in my own code. |
Wow, this is the second time I hear from a user who wants to run his Mocha tests in a different environment using the Test Explorer (see also #13). |
Sure. Foreword: I'm gonna glance over lots of stuff. I had lots of headaches putting all this stuff together. Ideas are basic but realization was tricky. Background: I'm writing a UI framework. Obviously you want to test this in browsers, not in node. Core idea: I'm just spawning a tiny So at this point I can just Mocha can run in browser so there's nothing really groundbreaking here. Since my tests modify the DOM I isolated them in an iframe distinct from the reporter, that's maybe the first tricky bit. Going headless: Then I just added a headless mode. After starting the server, I spawn a headless browser that runs the tests. Best option here for portability is probably to use webdriver, but because I'm a cheapo I just start Chrome with Second trick: I created a reporter that posts events back to my server. The server then uses regular reporters to display the test run in CLI. This is not too hard but tests objects don't serialize well (circular references, methods and more), so I had to hand pick what I want to transfer over the wire and reproduce it on the server-side. I did it so that most built-in reporters work: When the test run is done ( Integrating VS Test Explorer: That's the most hacky part. Up to here things were relatively clean-ish.
The really hacky part is discovering tests. Once again, you guessed it, I'm a sloth. The right thing to do is to do that remotely in a browser but that's a lot of work. So instead I'm just letting you do your thing inside Node. The problem with that is that a lot of code loaded by my tests doesn't run. To workaround that part (here's the worst hack):
And voilà. I'm very happy with the result. Thanks for the Test Explorer! |
This snippet:
Does not update the UI (test states stays a gray square).
If I rename the test
should equal data
it works.My guess: a regexp is built without encoding and
$
means end-of-string -> no match.The text was updated successfully, but these errors were encountered: