Giter VIP home page Giter VIP logo

eslint-plugin-codeceptjs's People

Contributors

alexout avatar dependabot[bot] avatar diego-codes avatar fakiolinho avatar kapilpau avatar macintoshpie avatar mbelsky avatar poenneby avatar textbook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eslint-plugin-codeceptjs's Issues

Error while linting for rule no-actor-in-scenario

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:

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,
  })
})

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"
  }

Can you help resolve the error?

tryTo is not defined

Using your plugin I'm having a problem with lint complaining when I try to use the tryTo plugin for CodeceptJS, even though the function use works in the tests. Are Codecept plugins missing from this eslint plugin?

I did add the plugin to the .eslintrc file as instructed (tried both the "extends" and the "plugins" way but neither makes a difference) and based on all the other Codeceptjs warnings disappearing from the tests I assume it is working.

I'm happy to provide additional information if needed.

Looking for rule ideas! ๐Ÿ’ก

This plugin is extremely simple as it currently only defines the globals in CodeceptJS.
Here are some ideas of rules:

  • prefer_page_objects - Prevent the use of I within Scenario โœ…
  • missing_feature - Scenarios without Feature function call
  • missing_generator - Use of yield within a Scenario while missing generator function * declaration

Feel free to suggest others!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.