Skip to content
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

Documentation: How to run mocha tests using low binary instead of node #18

Closed
lll000111 opened this issue Oct 14, 2018 · 9 comments
Closed

Comments

@lll000111
Copy link

lll000111 commented Oct 14, 2018

Before I run code on the device I would like to use the platform binary or low.js to run the transpiled code on the development system. Specifically and as a use case example, I want to run the existing mocha tests (used for node.js and browser thus far).

This does not seem to be trivial, I can't find a way to run mocha tests on low. I would appreciate this added to documentation. Automated tests are a must, how would one use one of the most widely used tets runners with low.js?

Related: svaarala/duktape#1549

@ThomasRogg
Copy link
Member

Sorry for the late answer!

Well, when low.js is done it should just work like Node. If it is not, something is simply not implemented yet.

Another thing which could be in the way is that low.js is only ES5 (ES6 seamlessly with automatic transpilation when syncing with ESP32), while some modules in npm are ES6. For use cases like this (tests on PC), we are planning on adding optional automatic transpilation with babel to the low binary.

I would say, tell us what you already tried, but I guess you have an idea now, because you opened issue 24. Closing because of this.

@lll000111
Copy link
Author

(Please reopen)

Possibly relevant: mochajs/mocha#956

@ThomasRogg
Copy link
Member

Trying to get an example going with mocha is high on our list. I guess this will happen this month. I will report here.

@ThomasRogg ThomasRogg reopened this Nov 7, 2018
@lll000111
Copy link
Author

I added my observations in mochajs/mocha#956 (comment) - they already support running mocha from JS in the browser, strange that the same steps don't work from node.js. I'm too lazy to now debug the mocha.js file though.

@lll000111
Copy link
Author

The current stopper is npm dependency "supports-color" of mocha — because it has a let statement in line 7 of its index.js file.

Duktape and therefore low.js already accepts const (I think Duktape treats it as var), let should be possible on the same (preliminary, incomplete) level.

Reference: svaarala/duktape#2000

@ThomasRogg
Copy link
Member

No, let is not yet supported in DukTape.

But, as I wrote: "For use cases like this (tests on PC), we are planning on adding optional automatic transpilation with babel to the low binary."

Hopefully this will be done this month.

@ThomasRogg
Copy link
Member

Just FYI: The current pipeline here is as follows:

  • Get lowsync API and UI in IDE for npm modules working (works in the lab already, really is fun!)
  • Small revamp of lowsync (better monitor and so on)
  • WebSockets Server

After that we could look into mocha.

@lll000111
Copy link
Author

You can make mocha a lower priority before any other blockers, I can code-write my way around that.

@ThomasRogg
Copy link
Member

Will not be done in foreseable future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants