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

Compiling of files keeps failing when there is a bad import statement #195

Open
Bertg opened this issue Aug 4, 2022 · 1 comment
Open

Comments

@Bertg
Copy link

Bertg commented Aug 4, 2022

I originally opened an issue on badeball/cypress-cucumber-preprocessor. The maintainer pointed out that the issue is within this package.

So the report here is the original report, including some badeball/cypress-cucumber-preprocessor related info:

Current behavior

Given I have a step definition file that contains an invalid (relative) import
When I start cypress and try to run that feature
Then I get the following error
  > Error: Build failed with 1 error:
  > cypress/e2e/test.js:1:42: ERROR: Could not resolve "../support/helpers"
When I then fix the broken import
Then I still get the error

Desired behavior

When the broken import is fixed, the feature should start running.

Test code to reproduce

https://github.com/younited/cypress_cucumber_import_bug

Instructions on how to replicate the issue are in the readme.

Versions

  • Cypress version: 10.4.0
  • Cypress version: 10.4.0
  • Esbuild Preprocessor version: 2.1.3
  • Esbuild version: 0.14.51
  • Node version: 16.14.2
@MDG-JHowley
Copy link

https://github.com/sod/cypress-esbuild-preprocessor#readme seems to work as an alternative.

Or you could try disabling the preprocessor's file watching which seems to indirectly resolve the problem e.g.

const createBundler = require('@bahmutov/cypress-esbuild-preprocessor')

module.exports = (on, config) => {
  const filePreprocessor = createBundler({
    // ...whatever your config is
  });

  on('file:preprocessor', (file) => {
    file.shouldWatch = false;
    return filePreprocessor(file);
  });
}

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