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

Compatibility with cucumber preprocessor #30

Closed
titenis opened this issue Dec 20, 2022 · 3 comments
Closed

Compatibility with cucumber preprocessor #30

titenis opened this issue Dec 20, 2022 · 3 comments
Labels

Comments

@titenis
Copy link

titenis commented Dec 20, 2022

Hello,
Any idea how to run cypress-vite with @badeball/cypress-cucumber-preprocessor? Having such configuration in cypress config:

async function setupNodeEvents(
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions,
): Promise<Cypress.PluginConfigOptions> {
  await CypressCucumberPreProcessor.addCucumberPreprocessorPlugin(on, config);

  on('file:preprocessor', vitePreprocessor());
return config;
}

Throws errors when running tests:

Oops...we found an error preparing this test file:

  > cypress/e2e/404/404.feature

The error was:

RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)

It works fine with @cypress/browserify-preprocessor and this config:

async function setupNodeEvents(
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions,
): Promise<Cypress.PluginConfigOptions> {
  await CypressCucumberPreProcessor.addCucumberPreprocessorPlugin(on, config);

  on(
    'file:preprocessor',
    preprocessor(config, {
      ...browserify.defaultOptions,
      typescript: createRequire(import.meta.url).resolve('typescript'),
    }),
  );
return config;
}
@mammadataei
Copy link
Owner

Hey @titenis,
This issue is not related to the cypress-vite. The problem is that Vite doesn't know how to handle .feature files. You need a Vite plugin for compiling .feature files; something like https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/esbuild.ts.

Unfortunately, I couldn't find a plugin, but I think it's easy to develop one using @badeball/cypress-cucumber-preprocessor.
https://vitejs.dev/guide/api-plugin.html#transforming-custom-file-types

Anyway, let me know if there is anything I can help you with.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2023

This issue is automatically marked as stale because it has been open for 30 days with no activity. Remove the stale label or leave a comment, or it will be closed in 14 days.

@github-actions github-actions bot added the stale label Mar 5, 2023
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 14 days with no activity. Please feel free to open a new issue if you have any further questions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants