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

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 this issue Aug 21, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@mark0203
Copy link

mark0203 commented Aug 21, 2023

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

  • pnpm install --save-dev @cypress-audit/pa11y
  • support/commands.ts has this: import "@cypress-audit/pa11y/commands";
  • The e2e specfile looks like this
describe('template', () => {
  it('simplest test', () => {
    cy.visit('/')
    cy.pa11y()
  })
})
  • cypress.config.ts looks like this and has an issue on line 2
    • 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)
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',
  },
});
  • in tsconfig.json visual studio code gives me this error on line 1
  • Cannot find type definition file for 'node'.
    The file is in the program because:
    Entry point of type library 'node' specified in compilerOptions ts

Expected behavior

  • The test does run, so it could also be something Visual studio code related?
  • I get no errors in Visual studio code when using a javascript framework
  • So I'm expecting no errors when using a typescript framework

Environment (please complete the following information):

  • OS: Windows10 x64
  • Chrome version: 115.0.5790.173
  • Cypress version: 12.17.3
  • VSCode version: 1.81.1
  • Node.js: 16.17.1
@mark0203 mark0203 added the bug Something isn't working label Aug 21, 2023
@ChaseBig
Copy link

ChaseBig commented Dec 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants