Closed peteringram0 closed 5 years ago
Are you talking about ES6 imports? How do you run your tests when not using this adapter?
Yes. via karma (im guessing thats the issue?)
Yes, this adapter only works with tests that are run with Jasmine directly. There is a request for a Karma Test Adapter but since I don't use Karma myself, someone else would have to implement it.
It seems that jasmine-es6 doesn't work with the explorer. I installed jasmine-es6 by using:
$> sudo npm install -g jasmine-es6 --save-dev
and then I created examples by using jasmine command:
$> jasmine init
$> jasmine examples
Then I changed the Player.js and PlayerSpec.js to use export and import. unfortunately this doesn't work (from "Jasmine Explorer" in OUTPUT panel):
(function (exports, require, module, filename, dirname) { import { Player } from '../../lib/jasmine_examples/Player'; ^ SyntaxError: Unexpected token {
However, I can run jasmine via command line and get the correct results:
$> jasmine
Started .....5 specs, 0 failures Finished in 0.056 seconds
How can I change configurations to make the explorer work?
@raof01 This test adapter always uses the original jasmine (which is bundled with the extension), whereas when you call jasmine on the command line you'll get the modified version of jasmine from the jasmine-es6 package. That's why it works on the command line but not in the Test Explorer.
If this is just about enabling es6 support (through babel), I'd suggest you find a way to do that with the original jasmine. For example, this repo uses babel and jasmine and works with this extension as soon as I tell it where it can find jasmine.json
by adding "jasmineExplorer.config": "test/unit/jasmine.json"
to the settings.
Thanks for sharing the info. Now it works. Do you have any plan to support selection of es6 and es5, etc.? Or Karma adapter you mentioned above will consider this kind of choices of ECMAScript versions?
This adapter only connects jasmine to the Test Explorer, it doesn't modify jasmine (nor do I plan to do that in the future). So you'd have to ask that question to the developers of jasmine, if they support it, so will this adapter.
It's clear for me now. Thanks for your patience.
Any .spec file that has a import does not show. If the imports are removed from the file it will show.