Created
September 24, 2017 08:54
-
-
Save pvdz/488d0db66bd6e23b67a55f6e08a9cf08 to your computer and use it in GitHub Desktop.
Silly mocha+babel problem with relative imports outside project root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How do you mocha+babel test projectA as is? | |
Note that projectB also its own mocha+babel tests which run fine (but they do not need to run here). | |
// ..../somedir/projectA/src/index.js | |
import {x} from '../../projectB/src/index.js'; | |
... | |
// ..../somedir/projectB/src/index.js | |
import {x} from './tools.js'; | |
... | |
// something like this works for all my projects, including projectB | |
node_modules/.bin/mocha --compilers js:babel-core/register tests/specs/**/*.js | |
How do I make it work for projectA without blowing up on the import keyword | |
in projectB? Note that I explicitly want to import projectB as es6. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The solution was to make sure a
.babelrc
exists in all folders included this way. One was missing which blew up the stack.