ReferenceError: exports is not defined when calling injectAxe() through typescript
See original GitHub issueIssue Description
I have this in my support/index.ts
my tsconfig.json looks like this:
{
"compilerOptions": {
"lib": [
"dom",
"es2015",
"es5",
"es6",
"es2015"
],
"target": "es5",
"module": "commonjs",
"noImplicitAny": false,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
},
"files": [
"./support/index.d.ts"
]
}
I have this test:
describe("TypeScript", () => {
it("checks shape of an object", () => {
cy.visit('http://localhost:6001')
cy.injectAxe();
});
})
It fails with
ReferenceError: exports is not defined at axeFunction (eval at cy.window.then.window (http://localhost:6001/__cypress/tests?p=cypress/support/index.ts-538:111:12),
:16:14) at eval (eval at cy.window.then.window (http://localhost:6001/__cypress/tests?p=cypress/support/index.ts-538:111:12), :15287:3) at eval ( )
Why would this be?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
ReferenceError: exports is not defined in TypeScript | bobbyhadz
To solve the Uncaught ReferenceError: exports is not defined, add a script tag that defines an `exports` variable, e.g. `` above your JS...
Read more >Typescript ReferenceError: exports is not defined
On a node.js server? You will need a module loader in the run-time environment that the javascript finally runs in. From the compiler...
Read more >How to fix ReferenceError: exports is not defined TypeScript
If you are getting the error for code that runs in the browser, try defining a global exports variable above the script tags...
Read more >Javascript – How to fix “ReferenceError: exports is not defined ...
If I write a .ts with any kind of import or export instruction the resulting .js will generate the following error when loaded...
Read more >react 灰符发布 - CSDN
We set calm to null , because it's the default value which you get by not including it at ... export default function...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rlaucik @Annie-Huang The latest release of cypress-axe (
0.8.1
) should take care of this issue.What is the fix for this problem? I got the same one…