-
Notifications
You must be signed in to change notification settings - Fork 13
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
vite@3.1.3
breaks cypress-vite
#5
Comments
v3.1.3
breaks cypress-vite
vite@3.1.3
breaks cypress-vite
@DrJume I've updated the cypress-vite/example/package.json Line 31 in 0738fbe
I'm not sure what's causing this issue, but I've added debugging at |
I forgot to mention that it happened on a clean install. When using |
Thanks for providing a debug output so quickly! I have reproduced the issue and logged it: |
I've cleared the
In If you didn't change it in your |
@mammadataei Holy Moly. |
I'm having the exact same issue, using Vite 3.1.7. I worked with Cypress using the regular Webpack builder first, which created some bundle artifacts that still ran correctly after switching to this package as the builder. But when I manually removed the contents of the projects folder (inside library/cypress/...) they also stopped working. There are no |
The only thing I could figure out was that the rollup is unable to transpile modules for some unknown reasons. I need a reproduction to work on this. Can anyone help with that? @Ragura, it may help if you can send me the debugging output. |
Hi @mammadataei , I am not sure about reproduction yet but in my case, I can't run some tests if I use path aliases in imports import { HUMAN_LIKE_SCROLL_DURATION, Page } from '../../support/test-configuration'; to something like this import { HUMAN_LIKE_SCROLL_DURATION, Page } from '@support/test-configuration'; I get the error. When I changed all imports back to the previous form, so that no import uses path alias, test worked again. I also don't get any additional output when I use import { defineConfig } from 'cypress';
import vitePreprocessor from 'cypress-vite';
export default defineConfig({
e2e: {
setupNodeEvents(on) {
on('file:preprocessor', vitePreprocessor());
},
baseUrl: 'https://127.0.0.1:8080/webserver/',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
defaultCommandTimeout: 5000,
supportFile: 'cypress/support/e2e.ts',
},
}); Edit: I think my problem is not related to newest vite version. Downgrading didn't solve the problem. I think in my case some tests work because they were previously processed by webpack preprocessor and after switching to vite they are not processed at all, hence the error about missing file |
@shwarcu Hi, I think, in your case, it can be due to configurations. Did you define path aliases in the vite config?! If not, try to do so and pass the vite config path to // vite.config.ts
import { compilerOptions } from './tsconfig.json'
function resolveAliasesFromTypescriptConfig() {
return Object.entries(compilerOptions.paths).reduce((acc, [key, [value]]) => {
const aliasKey = key.substring(0, key.length - 2)
const path = value.substring(0, value.length - 2)
return { ...acc, [aliasKey]: resolve(__dirname, path) }
}, {})
}
export default defineConfig({
resolve: {
alias: resolveAliasesFromTypescriptConfig(),
},
...
}) For debugging, I think there is no need for |
I very much suspect that the error is caused by: |
Fixes `vite@3.1.3` breaks `cypress-vite` mammadataei#5
Fixes "`vite@3.1.3` breaks `cypress-vite`" mammadataei#5
I found the cause of the bug: vitejs/vite#10116 only surfaced the bug. The issue was that other vite plugins (https://github.com/laravel/vite-plugin) interfered with Because of this, I am asking myself the question, if it is even suitable to use the plugins from the development build for spec files? After I noticed this, I made an empty vite config only for I found out that vite's Line 73 in cc0b5fd
So it uses the WorkaroundA workaround is specifying ConclusionTo fix this issue, I switched the config handling to using vite's integrated |
The behaviour of Handling option Resolving the |
fixes "`vite@3.1.3` breaks `cypress-vite`" #5 Co-authored-by: Mohammad Ataei <mammadataei@gmail.com>
@DrJume Thanks for debugging, detailed explanation, and PR. I merged your PR. I need to do some checks and release it within an hour. |
Should be solved in v1.2.1 |
After updating from
vite@3.1.1
to3.1.3
I get the following error when running a cypress test:The text was updated successfully, but these errors were encountered: