Please install babel-cli and call your file with: ./node_modules/.bin/babel-node testcase.js
It will fail. Now we have to fix your code.
testStep.js should look like:
var hello = () => { console.log('hello world'); }; var testStep = { hello: hello, }; export default testStep; Then, it will work. ;)
This first introduction on https://babeljs.io/ is, that you should install babel-cli and babel-preset-env. ;)
You can also write your testStep.js like this:
var testStep = { hello: hello, }; function hello () { console.log('hello world'); }; export default testStep; This keeps the hoisting in mind. Like Jacob said in his first point.