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

Error with Browserify Bundler #1273

Closed
3 tasks done
bhadmus opened this issue Feb 6, 2025 · 1 comment
Closed
3 tasks done

Error with Browserify Bundler #1273

bhadmus opened this issue Feb 6, 2025 · 1 comment

Comments

@bhadmus
Copy link

bhadmus commented Feb 6, 2025

Current behavior

I got this error when I tried to launch the test (I tried it on bot MacOS and Windows)

Error: Parsing file /Users/sanguine/Tutorial/tests/check-browserify/node_modules/@cucumber/messages/node_modules/uuid/dist/cjs-browser/v1.js: Unexpected token (28:18)
    at Deps.parseDeps (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/module-deps/index.js:519:15)
    at getDeps (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/module-deps/index.js:447:44)
    at /Users/sanguine/Tutorial/tests/check-browserify/node_modules/module-deps/index.js:430:38
    at ConcatStream.<anonymous> (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/concat-stream/index.js:37:43)
    at ConcatStream.emit (node:events:519:35)
    at ConcatStream.emit (node:domain:489:12)
    at finishMaybe (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/readable-stream/lib/_stream_writable.js:630:14)
    at endWritable (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/readable-stream/lib/_stream_writable.js:638:3)
    at ConcatStream.Writable.end (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/readable-stream/lib/_stream_writable.js:594:22)
    at DuplexWrapper.onend (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:621:28)
    at DuplexWrapper.emit (node:events:519:35)
    at DuplexWrapper.emit (node:domain:489:12)
    at endReadableNT (/Users/sanguine/Tutorial/tests/check-browserify/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
    at processTicksAndRejections (node:internal/process/task_queues:90:21)

My cypress.config.js file:


const { defineConfig } = require("cypress");
const browserify = require("@cypress/browserify-preprocessor");
const { addCucumberPreprocessorPlugin } = require("@badeball/cypress-cucumber-preprocessor");
const { preprendTransformerToOptions } = require("@badeball/cypress-cucumber-preprocessor/browserify");

async function setupNodeEvents(on, config) {
  await addCucumberPreprocessorPlugin(on, config);

  on(
    "file:preprocessor",
    browserify(preprendTransformerToOptions(config, browserify.defaultOptions))
  );

  return config;
}

module.exports = defineConfig({
    e2e: {
        baseUrl: 'https://example.cypress.io',
        specPattern: '**/*.feature',
        setupNodeEvents,
    },
});
    

My package.json file:

{
  "name": "cypress-project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "npx cypress run"
  },
  "devDependencies": {
    "@badeball/cypress-cucumber-preprocessor": "latest",
    "@cypress/browserify-preprocessor": "latest",
    "cypress": "latest"
  }
}

Desired behavior

It should load successfully as it should normally.

Cypress version

14.0.2

Preprocessor version

22.0.0

Node version

23.6.0

Operating system

macOS

Checklist

@badeball
Copy link
Owner

badeball commented Feb 9, 2025

Hi @bhadmus, this has been fixed with v22.0.1. I also recommend staying away from browserify.

@badeball badeball closed this as completed Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants