-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I'm in a case where tests and source code are both using imports (ES6 syntax). pectin wants modules to be set to false while mocha want them to be true.
Babel supports multiple envs in the babelrc config file, so supporting it in pectin would be great.
I'm currently using node v13.10.1, babel 6 and pectin ^3.6.1
PS: any other suggestions for me to do this in a "better" way are also welcome 😊
.babelrc file
{
"env": {
"test": {
"presets": [
[
"env",
{
"targets": {
"node": "current"
}
}
]
]
},
"build": {
"presets": [
[
"env",
{
"modules": false,
"targets": {
"node": "current"
}
}
]
]
}
}
}
sample app.js
export function foo () {
return 'bar'
}
sample test.spec.js
import { foo } from '../src/app'
describe('testing app', () => {
it('should return bar', function () {
expect(foo()).to.deep.equal('bar')
})
})
mocha.opts
--require babel-core/register
--require babel-register
--require test/setup.js
--recursive
Metadata
Metadata
Assignees
Labels
No labels