-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Open
Description
Bug Report
Current Behavior
@babel/register doesn't seem to use .babelrc file.
Input Code
I have the following TypeScript file containing some tests:
import { expect } from 'chai';
describe('sample', (): void => {
it('Returns false', (): void => {
expect(false).to.equal(false);
});
});My package.json contains the following script:
"scripts": {
"test": "npx mocha --require @babel/register spec/**/*.spec.ts"
}The following error is throwed when invoking the script:
import { expect } from 'chai';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Module._extensions..js (module.js:664:10)
at Object.newLoader [as .js] (C:\Users\kevin\Development\Node.JS\Datalytics\Server\Services\Datalytics.Services.Logging\node_modules\pirates\lib\index.js:88:7)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at C:\Users\kevin\Development\Node.JS\Datalytics\Server\Services\Datalytics.Services.Logging\node_modules\mocha\lib\mocha.js:250:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (C:\Users\kevin\Development\Node.JS\Datalytics\Server\Services\Datalytics.Services.Logging\node_modules\mocha\lib\mocha.js:247:14)
at Mocha.run (C:\Users\kevin\Development\Node.JS\Datalytics\Server\Services\Datalytics.Services.Logging\node_modules\mocha\lib\mocha.js:576:10)
at Object.<anonymous> (C:\Users\kevin\Development\Node.JS\Datalytics\Server\Services\Datalytics.Services.Logging\node_modules\mocha\bin\_mocha:637:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
Expected behavior/code
The tests should be executed.
Babel Configuration (.babelrc, package.json, cli command)
{
"presets": [
"@babel/typescript",
"@babel/env"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
],
"comments": false
}Environment
- Babel packages:
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-typescript": "^7.1.0",
"@babel/register": "^7.0.0",
- Node/npm version: Node 8.12.0 / NPM 6.4.1
- OS: Windows 10
- How you are using Babel:
register
Metadata
Metadata
Assignees
Labels
No labels