Skip to content

Setup a JavaScript test suite#1684

Merged
rth merged 4 commits intopyodide:mainfrom
rth:nodejs-tests
Jul 6, 2021
Merged

Setup a JavaScript test suite#1684
rth merged 4 commits intopyodide:mainfrom
rth:nodejs-tests

Conversation

@rth
Copy link
Copy Markdown
Member

@rth rth commented Jul 3, 2021

This sets up a JS test suite using Mocha.

The goal is to be able to test individual functions in src/js without running the build system.

The other goal is to start playing with Node.js in the future, and have tests for it. Though then we would need to build Pyodide core first.

As to the choice of the test package. It looks like the popular ones are Mocha and Jest. I'm not familiar with neither. I went with the first one as it seems more lightweight and also more of a community project. But we can change that if anyone has strong opinions about it.

@rth rth changed the title Setup a JS test suite Setup a JavaScript test suite Jul 3, 2021
* The main bootstrap code for loading pyodide.
*/
import { Module } from "./module";
import { Module } from "./module.js";
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise I was getting errors like,

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/rth/src/pyodide/src/js/module' imported from
 /home/rth/src/pyodide/src/js/api.js                                                              
Did you mean to import ../module.js?

@rth rth merged commit 327560a into pyodide:main Jul 6, 2021
@rth rth deleted the nodejs-tests branch July 6, 2021 08:48
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

Successfully merging this pull request may close these issues.

2 participants