Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add jest-playwright as an ESLint environment #80

Closed
thernstig opened this issue Mar 23, 2020 · 4 comments · Fixed by #94
Closed

Feature: Add jest-playwright as an ESLint environment #80

thernstig opened this issue Mar 23, 2020 · 4 comments · Fixed by #94
Labels
enhancement New feature or request

Comments

@thernstig
Copy link
Contributor

https://eslint.org/docs/user-guide/configuring#specifying-environments has a way to configure environments. It would be cool if jest-playwright was part of that, but I am not sure how feasible that is. This would avoid having to specify the globals that come with jest-playwright.

Maybe not worth it and then you can close this, but I just thought I'd bring up the idea even how minor it might be.

@mmarkelov mmarkelov added the enhancement New feature or request label Mar 23, 2020
@mmarkelov
Copy link
Member

@thernstig that's make sense

@mxschmitt
Copy link
Member

@thernstig could you try https://github.com/mxschmitt/eslint-plugin-jest-playwright?
Should fit for your needs, if yes then we can refer to this in the README.

@thernstig
Copy link
Contributor Author

@mxschmitt I verified that it works. A question though. The implementation has this:

module.exports = {
  configs: {
    recommended: {
      env: {
        node: true,
        jest: true,
      },
      globals: {
        browser: true,
        context: true,
        page: true,
        jestPlaywright: true,
      }
    }
  },
}

Isn't this more proper?

module.exports = {
  configs: {
    recommended: {
      env: {
        shared-node-browser: true,
        jest: true,
      },
      globals: {
        browser: true,
        context: true,
        page: true,
        jestPlaywright: true,
      }
    }
  },
}

Reason being that you can just document. in many of the Playwright functions that runs inside the browser.

@mxschmitt
Copy link
Member

@mxschmitt I verified that it works. A question though. The implementation has this:

module.exports = {
  configs: {
    recommended: {
      env: {
        node: true,
        jest: true,
      },
      globals: {
        browser: true,
        context: true,
        page: true,
        jestPlaywright: true,
      }
    }
  },
}

Isn't this more proper?

module.exports = {
  configs: {
    recommended: {
      env: {
        shared-node-browser: true,
        jest: true,
      },
      globals: {
        browser: true,
        context: true,
        page: true,
        jestPlaywright: true,
      }
    }
  },
}

Reason being that you can just document. in many of the Playwright functions that runs inside the browser.

good catch, will adjust this in a bit! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants