【发布时间】:2020-03-22 02:14:44
【问题描述】:
我有一个类,我正在尝试用 cucumberjs 进行测试。当我从功能中导入类时,它会在我运行 cucumberjs 时给我以下信息
我执行的命令
./node_modules/.bin/cucumber-js ./tests/features
我得到的错误
getAll = () => this.data;
^
SyntaxError: Unexpected token =
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
:
:
:
文件
// TestApi.js
class TestApi {
constructor(){
this.data = ['teststuff', 'teststuff2']
}
getAll = () => this.data;
}
//test.feature
const { Before, Given, When, Then } = require('cucumber')
const { TestApi } = require('../../../api/TestApi.js');
const { TestDomain } = require('../../../domain/domain.js');
【问题讨论】:
标签: javascript cucumber cucumberjs