cypress-esbuild-preprocessor
cypress-esbuild-preprocessor copied to clipboard
Compiling of files keeps failing when there is a bad import statement
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
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);
});
}