Running Mocha 6 ES6 tests with Babel 7, how to set up?

Testing in ES6 with Mocha and Babel 7. Look here: https://dev.to/bnorbertjs/my-nodejs-setup-mocha–chai-babel7-es6-43ei or http://jamesknelson.com/testing-in-es6-with-mocha-and-babel-6/ npm install –save @babel/runtime npm install –save-dev @babel/plugin-transform-runtime And, in .babelrc, add: { “presets”: [“@babel/preset-env”], “plugins”: [ [“@babel/transform-runtime”] ] }

What is target in tsconfig.json for?

I am quite new to Typescript. What does Target in tsconfig.json signify? target signifies which target of JavaScript should be emitted from the given TypeScript. Examples: target:es5 ()=>null will become function(){return null} as ES5 doesn’t have arrow functions. target:es6 ()=>null will become ()=>null as ES6 has arrow functions. More I also made a quick video … Read more

Extending Error in Javascript with ES6 syntax & Babel

Based on Karel BĂ­lek’s answer, I’d make a small change to the constructor: class ExtendableError extends Error { constructor(message) { super(message); this.name = this.constructor.name; if (typeof Error.captureStackTrace === ‘function’) { Error.captureStackTrace(this, this.constructor); } else { this.stack = (new Error(message)).stack; } } } // now I can extend class MyError extends ExtendableError {} var myerror = … Read more