-
Notifications
You must be signed in to change notification settings - Fork 146
Support nodejs experimental-modules #150
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
Comments
As a workaround: Create a file called "jasmine-run.mjs":
The script would be called like:
That is not sufficient... In jasmine.js (jasmine-core/lib/jasmine.js): #6428 You need to extends the StackTrace handling function like this:
On stackoverflow: https://stackoverflow.com/questions/47832603/running-tests-mjs-esm-on-node-using-jasmine-or-any-other-alternative/54691621#54691621 |
That sounds like a nice thing to be able to support. I would be happy to review a Pull Request here to add some the same kind of Thanks for using Jasmine! |
The stacktrace management is done here: https://github.com/jehon/jasmine/commit/d985a24acc4c5dae68c1301a4368f0fac08bb47c Have a nice day |
Hello @slackersoft, After it is ok, I will have a look to a clean way to do this part... Have a nice day |
So Node 12 is realesed now. Congratulations! =) Any updates on topic? |
Hello, The work to do in the other card is to huge for me, and require to understand the full testing system. I didn't have the time to work on this now, and in short term, I will not be able to give time. So, if someone want to take over, please feel free to do so. |
This issue is still relevant. I reproduced it with node v12.8.0, but I won't be able to work on it for now. workaroundIt looks like this issue only affects the CLI ( Here is my configuration file:
See https://github.com/noelmace/devcards/blob/master/karma.jasmine.conf.js Also, see open-wc/open-wc#729 for some context. |
Not sure if this helps anyone, I've been using the $ yarn global install jasmine esm
$ jasmine --require=esm src/*.spec.js |
+1 |
I've been working on this, and I think I have something that's just about ready to go. But I'm having trouble finding real-world examples to test with. It would be a great help if anyone can point me at something that's publicly available (preferably an npm package), can only be imported as an ES module, and works in Node without being transpiled or bundled. |
ES module support was released in version 3.6.2 of the Jasmine npm package. |
Sounds amazing! How do you use the new ES module support? In the release notes it mentions that the files need to have the Edit: I created a separate issue for it: #170 I didn't notice that this one was closed already. |
@JannesMeyer Adding
does not. My problem is that I need |
Expected Behavior
We should be able to use the "ecmascript" experimental modules of nodejs (https://nodejs.org/dist/latest-v11.x/docs/api/esm.html),
Current Behavior
we receive an error:
Possible Solution
Jasmine should use "import" instead of "require" when loading esm modules. But that is not that easy, since "import" is asynchronous, while require is synchronous. And we need to know when do we have a "esm" module.
Suite that reproduces the behavior (for bugs)
launch nearly as usual:
Context
This is blocking to use jasmine in this new (experimental) context.
Your Environment
The text was updated successfully, but these errors were encountered: