forked from Klaveness-Digital/cypress-cucumber-preprocessor
-
-
Notifications
You must be signed in to change notification settings - Fork 153
Closed
Description
Current behavior
If I take the esbuild-cjs example as is with prettySourceMap
set in the configuration, and modify the test as follows:
Then("I should see a search bar", () => {
cy.get("input[type=text]")
.should("have.attr", "placeholdr")
.and(
"match",
/Search the web without being tracked|Search without being tracked/
);
assert.deepEqual({}, {});
});
it fails as I would expect, but in open mode of Cypress you do not see a proper stack trace:

Desired behavior
If I change the config to set sourcemap on the esbuild bundler directly:
const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const {
addCucumberPreprocessorPlugin,
} = require("@badeball/cypress-cucumber-preprocessor");
const {
createEsbuildPlugin,
} = require("@badeball/cypress-cucumber-preprocessor/esbuild");
async function setupNodeEvents(on, config) {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
createBundler({
sourcemap: 'inline',
plugins: [createEsbuildPlugin(config)],
})
);
// Make sure to return the config object as it might have been modified by the plugin.
return config;
}
module.exports = defineConfig({
projectId: 'kh9ew9',
e2e: {
baseUrl: "https://duckduckgo.com",
specPattern: "**/*.feature",
setupNodeEvents,
},
});
I get a proper stack trace:

Cypress version
any
Preprocessor version
v22.0.1
Node version
v22
Operating system
macOS 14.16.1
Checklist
- I've read the FAQ.
- I've read instructions for logging issues.
- I'm not using
[email protected]
(package name has changed and it is no longer the most recent version, see #689).
Metadata
Metadata
Assignees
Labels
No labels