2

I get the following error while running the eslint command

PS C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project> eslint "**/*.ts" --ignore-pattern node_modules/

Oops! Something went wrong! :(

ESLint: 8.15.0

TypeError: Cannot read properties of undefined (reading 'property')
Occurred while linting C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\src\tests\rest\Get.test.ts:3
Rule: "codeceptjs/no-actor-in-scenario"
    at C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\node_modules\eslint-plugin-codeceptjs\lib\rules\no-actor-in-scenario.js:30:63
    at Array.map (<anonymous>)
    at C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\node_modules\eslint-plugin-codeceptjs\lib\rules\no-actor-in-scenario.js:29:32
    at Array.map (<anonymous>)
    at C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\node_modules\eslint-plugin-codeceptjs\lib\rules\no-actor-in-scenario.js:27:34
    at Array.map (<anonymous>)
    at CallExpression (C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\node_modules\eslint-plugin-codeceptjs\lib\rules\no-actor-in-scenario.js:21:26)
    at ruleErrorHandler (C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\node_modules\eslint\lib\linter\linter.js:1114:28)
    at C:\WORK\AutomationPlayground\codeceptjs-boilerplate-project\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)

This is Get.test.ts file that is causing the error:

Feature('GET tests').tag('@REST')

Scenario('Verify a successful call', async ({ I }) => {
  await I.sendGetRequest('/api/users?page=2')
  I.seeResponseCodeIsSuccessful()
})

Scenario('Verify a not found call', async ({ I }) => {
  await I.sendGetRequest('/api/users/266')
  I.seeResponseCodeIsClientError()
})

Scenario('Verify getting a single user', async ({ I }) => {
  const { data } = await I.sendGetRequest('/api/users/2')

  I.seeResponseContainsKeys(data)
  I.seeResponseValidByCallback(({ data, expect }) => {
    expect(data.id)
  })
})

Scenario('Verify getting list of users', async ({ I }) => {
  const { data } = await I.sendGetRequest('/api/users?page=2')

  I.seeResponseContainsKeys(data)
  I.seeResponseContainsJson({
    page: 2,
    total: 12,
    per_page: 6,
  })
})

These are the configuration files for lining: This is the .eslintrc file:

{
  "plugins": [
    "codeceptjs"
  ],
  "parserOptions": {
    "sourceType": "module"
  },
  "env": {
    "codeceptjs/codeceptjs": true,
    "es2020": true
  },

  "rules": {
    "codeceptjs/no-actor-in-scenario": "warn",
    "codeceptjs/no-skipped-tests": "error"
  }
}

This is my package.json:

"dependencies": {
    "@codeceptjs/configure": "^0.8.0",
    "@codeceptjs/ui": "0.4.6",
    "codeceptjs": "3.3.2",
    "codeceptjs-expectwrapper": "^1.0.2",
    "codeceptjs-resemblehelper": "^1.9.6",
    "expect": "^26.6.2",
    "faker": "^4.1.0",
    "form-data": "^3.0.0",
    "fs-extra": "^10.1.0",
    "playwright": "^1.21.0",
    "prettier": "2.6.2",
    "ts-node": "^10.7.0",
    "typescript": "^4.6.3"
  },
  "devDependencies": {
    "eslint": "^8.15.0",
    "eslint-plugin-codeceptjs": "^1.3.0"
  }

I couldn't find anything on this one.
It seems maybe like some plugin issue. Not really sure.
Can you help resolve the error?

mismas
  • 1,236
  • 5
  • 27
  • 55

0 Answers0