Title: ESM issues · Issue #835 · browserstack/browserstack-cypress-cli · GitHub
Open Graph Title: ESM issues · Issue #835 · browserstack/browserstack-cypress-cli
X Title: ESM issues · Issue #835 · browserstack/browserstack-cypress-cli
Description: I'm trying to run Cypress tests on Browserstack, but keep getting this. I'm on Cypress 13.6.4 and browserstack-cypress-cli@1.31.0 Not sure how to fix this ESM/CJS issue. Here's my cypress.config.ts import task from "@cypress/code-coverag...
Open Graph Description: I'm trying to run Cypress tests on Browserstack, but keep getting this. I'm on Cypress 13.6.4 and browserstack-cypress-cli@1.31.0 Not sure how to fix this ESM/CJS issue. Here's my cypress.config.ts...
X Description: I'm trying to run Cypress tests on Browserstack, but keep getting this. I'm on Cypress 13.6.4 and browserstack-cypress-cli@1.31.0 Not sure how to fix this ESM/CJS issue. Here's my cypre...
Opengraph URL: https://github.com/browserstack/browserstack-cypress-cli/issues/835
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ESM issues","articleBody":"I'm trying to run Cypress tests on Browserstack, but keep getting this. I'm on Cypress 13.6.4 and `browserstack-cypress-cli@1.31.0`\r\n\r\nNot sure how to fix this ESM/CJS issue. Here's my `cypress.config.ts`\r\n\r\n```\r\nimport task from \"@cypress/code-coverage/task\";\r\nimport { allureCypress } from \"allure-cypress/reporter\";\r\nimport { defineConfig } from \"cypress\";\r\nimport cypressSplit from \"cypress-split\";\r\n\r\nexport default defineConfig({\r\n e2e: {\r\n specPattern: \"cypress/e2e/**\",\r\n supportFile: \"cypress/support/index.js\",\r\n projectId: \"test\",\r\n video: true,\r\n chromeWebSecurity: false,\r\n reporter: \"cypress-multi-reporters\",\r\n screenshotsFolder: \"./cypress/report/mochawesome-report/assets/screenshots\",\r\n reporterOptions: {\r\n configFile: \"reporter-config.json\"\r\n },\r\n numTestsKeptInMemory: 0,\r\n retries: {\r\n runMode: 1,\r\n openMode: 0\r\n },\r\n viewportWidth: 1920,\r\n viewportHeight: 1920,\r\n defaultCommandTimeout: 40000,\r\n requestTimeout: 30000,\r\n pageLoadTimeout: 40000,\r\n setupNodeEvents(on, config) {\r\n task(on, config);\r\n\r\n cypressSplit(on, config);\r\n // allureWriter(on, config);\r\n allureCypress(on, {\r\n resultsDir: \"./allure-results\"});\r\n on(\"before:browser:launch\", (browser, launchOptions) => {\r\n launchOptions.args.push(\"--another-arg\");\r\n if (browser.family === \"chromium\" && browser.name !== \"electron\") {\r\n launchOptions.args.push(\"--disable-dev-shm-usage\");\r\n }\r\n return launchOptions;\r\n });\r\n return config;\r\n }\r\n }\r\n});\r\n```\r\n\r\n```\r\n/Users/pcanella/.nvm/versions/node/v18.19.0/lib/node_modules/browserstack-cypress-cli/bin/helpers/requireModule.js:7\r\nconst mod = require(moduleName)\r\n ^\r\n\r\nError [ERR_REQUIRE_ESM]: require() of ES Module /Users/pcanella/gitrepo/feecalculatorfe/tmpBstackCompiledJs/cypress.config.js from /Users/pcanella/.nvm/versions/node/v18.19.0/lib/node_modules/browserstack-cypress-cli/bin/helpers/requireModule.js not supported.\r\ncypress.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which declares all .js files in that package scope as ES modules.\r\nInstead either rename cypress.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change \"type\": \"module\" to \"type\": \"commonjs\" in /Users/pcanella/gitrepo/feecalculatorfe/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).\r\n\r\n at Object.\u003canonymous> (/Users/pcanella/.nvm/versions/node/v18.19.0/lib/node_modules/browserstack-cypress-cli/bin/helpers/requireModule.js:7:13) {\r\n code: 'ERR_REQUIRE_ESM'\r\n}\r\n\r\n```","author":{"url":"https://github.com/pcanella","@type":"Person","name":"pcanella"},"datePublished":"2024-05-28T22:38:26Z","url":"https://github.com/browserstack/browserstack-cypress-cli/issues/835"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3bb79a26-9f84-0510-df21-3c6a46e2aa4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C534:1567FF:4F6EF0:6B5AD5:6B043D32 |
| html-safe-nonce | 5c64ca3abca81e5adef0bb2f896ca85d703d827de139264e2405897ba01503ec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTM0OjE1NjdGRjo0RjZFRjA6NkI1QUQ1OjZCMDQzRDMyIiwidmlzaXRvcl9pZCI6IjU0ODIxNDIwODE0MTU5MjA5NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7b30e92681f8d84749034da2ef58a2579112fad5da800f15988144baf9f96330 |
| hovercard-subject-tag | issue:2322028486 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/browserstack/browserstack-cypress-cli/835/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5997d54c5c5f86a565af63e44f85eaf00c9d55bd6e4ef74edaf50716d24be2ca/browserstack/browserstack-cypress-cli/issues/835 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5997d54c5c5f86a565af63e44f85eaf00c9d55bd6e4ef74edaf50716d24be2ca/browserstack/browserstack-cypress-cli/issues/835 |
| og:image:alt | I'm trying to run Cypress tests on Browserstack, but keep getting this. I'm on Cypress 13.6.4 and browserstack-cypress-cli@1.31.0 Not sure how to fix this ESM/CJS issue. Here's my cypress.config.ts... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pcanella |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| go-import | github.com/browserstack/browserstack-cypress-cli git https://github.com/browserstack/browserstack-cypress-cli.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 242935045 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-cypress-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 242935045 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-cypress-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width