codeceptjs / codeceptjs/CodeceptJS

Gherkin steps not getting generated when using import statement in the code

未关闭
#1,914 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
4.2k
派生
757
平均合并
2 天 9 小时
30 天内合并 PR
16

描述

#### What are you trying to achieve?
Generate the gherkin code from bdd
#### What do you get instead?
Error :"Unexpected Indentifier"
> Provide console output if related. Use `--verbose` mode for more details.

Error: Could not include object Step Definition from ./step_definitions/givensteps.js from module 'C:\Projects\UNSW TESTS\e2e\unswcodecept\e2e\step_definitions\givensteps.js'
Could not include object loginPage from module 'C:\Projects\UNSW TESTS\e2e\unswcodecept\e2e\pages\login.js'
Unexpected identifier
at loadSupportObject (C:\Projects\UNSW TESTS\e2e\unswcodecept\node_modules\codeceptjs\lib\container.js:309:11)
at loadGherkinSteps (C:\Projects\UNSW TESTS\e2e\unswcodecept\node_modules\codeceptjs\lib\container.js:282:5)
at Function.create (C:\Projects\UNSW TESTS\e2e\unswcodecept\node_modules\codeceptjs\lib\container.js:37:25)
```bash
# paste output here
```

> Provide test source code if related
const { I } = inject();

const username = {id:'username'};
const password = {id:'password'};
const submitbtn = {id:'login'};

**import config from 'config';**

module.exports=
{
loginAsFaculty() {
console.log("Inside login")
I.amOnPage(config.get("baseUrl"))
I.fillField(username, config.get("slpEditUser.username"));
I.fillField(password, config.get("slpEditUser.password"));
I.click(submitbtn);
}

```js
// paste test
```

### Details
If I convert the import into require(common.js), then the error is gone.

Please plan to support ES6.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。