cy.prompt() get code error
#33110
Replies: 2 comments 2 replies
-
|
Did you try clicking on "Learn more" to see what advice |
Beta Was this translation helpful? Give feedback.
-
|
This error means your project isn't generating source maps, which If you're using the default Cypress config (no custom preprocessor), add this to import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('task', {})
},
},
// Enable source maps
env: {},
// Add this at the root level
sourceMapMode: 'inline',
})If you're using webpack (most common setup), enable source maps in your webpack config: // cypress.config.ts
import { defineConfig } from 'cypress'
const webpackPreprocessor = require('@cypress/webpack-preprocessor')
export default defineConfig({
e2e: {
setupNodeEvents(on) {
const options = {
webpackOptions: {
devtool: 'source-map', // this is the key line
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
},
}
on('file:preprocessor', webpackPreprocessor(options))
},
},
})If you're using Vite: // vite.config.ts
export default {
build: {
sourcemap: true,
},
}If you're using TypeScript with {
"compilerOptions": {
"sourceMap": true
}
}The quickest way to confirm it's working — after making the change, open Cypress, run your spec, and click the What preprocessor or bundler are you using? That'll help narrow down which of the above applies to your setup. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Enable source maps to use cy.prompt
Source maps are required for cy.prompt functionality and are not available for this spec. Please set up your preprocessor to generate source maps in this project.
Beta Was this translation helpful? Give feedback.
All reactions