mfrachet / cypress-audit

⚡ Run Lighthouse and Pa11y audits directly in your E2E test suites
https://mfrachet.github.io/cypress-audit/
MIT License
351 stars 44 forks source link

VSCode Pa11y and typescript - /node_modules/.pnpm/@cypress-audit+pa11y@1.4.2/node_modules/@cypress-audit/pa11y/index.d.ts' is not a module #230

Open mark0203 opened 11 months ago

mark0203 commented 11 months ago

What does not work? In Visual studio code, I get this message "File 'C:/PROJ/Cypress_Typescript_Pa11y/node_modules/.pnpm/@cypress-audit+pa11y@1.4.2/node_modules/@cypress-audit/pa11y/index.d.ts' is not a module.ts(2306)"

How to reproduce? I've used an empty cypress Typescript framework like this one: https://github.com/mark0203/ta_docs/tree/main/CYPRESS/Cypress_Typescript_empty_framework

const { defineConfig } = require("cypress");
const { pa11y, prepareAudit } = require("@cypress-audit/pa11y");

module.exports = defineConfig({
  video: false,
  e2e: {
    setupNodeEvents(on, config) {
      on("before:browser:launch", (browser = {}, launchOptions) => {
        prepareAudit(launchOptions);
      });

      on("task", {
        pa11y: pa11y(),
      });
    },
    baseUrl: 'https://example.cypress.io',
  },
});

Expected behavior

Environment (please complete the following information):

ChaseBig commented 7 months ago

I believe this fixed it for me const { pa11y } = require("@cypress-audit/pa11y");