W
W
WizardW2021-01-11 19:57:56
Software testing
WizardW, 2021-01-11 19:57:56

Why am I getting the error ReferenceError: module is not defined?

error:

npm run test:e2e

> [email protected] test:e2e D:\projects\react-labs-app
> cd e2e && jest

ReferenceError: module is not defined
    at file:///D:/projects/react-labs-app/e2e/jest.config.js:1:1
    at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
    at async Loader.import (internal/modules/esm/loader.js:166:24)
    at async readConfigFileAndSetRootDir (D:\projects\react-labs-app\node_modules\jest\node_modules\jest-config\build\readConfigFileAndSetRootDir.js:126:32)
    at async readConfig (D:\projects\react-labs-app\node_modules\jest\node_modules\jest-config\build\index.js:217:18)
    at async readConfigs (D:\projects\react-labs-app\node_modules\jest\node_modules\jest-config\build\index.js:406:26)
    at async runCLI (D:\projects\react-labs-app\node_modules\jest\node_modules\@jest\core\build\cli\index.js:230:59)
    at async Object.run (D:\projects\react-labs-app\node_modules\jest\node_modules\jest-cli\build\cli\index.js:163:37)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:e2e: `cd e2e && jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Sparta\AppData\Roaming\npm-cache\_logs\2021-01-11T16_39_52_806Z-debug.log


All code on the e2e-tests branch: https://github.com/daniilgri/react-labs-app/tree/e...
Run script "test:e2e": "cd e2e && jest"
e2e folder is on the same level as package .json, it contains jest config and jest-puppeteer.

jest-puppeteer.config.js
module.exports = {
  launch: {
    headless: false,
    slowMo: 300,
  },
};

jest.config.js
module.exports = {
  preset: "jest-puppeteer",
  globals: {
    URL: "http://localhost:3000",
  },
};

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question