Closed namespace-github closed 1 year ago
I have the same thing. I force an error when it comes to a warning in the test. This aborts my test.
@namespace-github I have seen this warning sometimes in the past but I am not able to recreate it currently. Can you confirm what version of Cypress you are using? And please try 10.1.0 if you are not already on it.
I seem to get this warning in Vue 3, Vite 2, cypress 10.1. But only when I try to mount with cypress spies on event handlers per https://docs.cypress.io/guides/component-testing/events-vue#Arrange
I haven't tried it on a minimal reproduction, but that seems to be where I'm getting this same warning in my project
my component tests also break when I try to assert on them, but I think that might be a me thing
@namespace-github I have seen this warning sometimes in the past but I am not able to recreate it currently. Can you confirm what version of Cypress you are using? And please try 10.1.0 if you are not already on it.
@marktnoonan: Important to get the Error is to "cy.stub" window.console like below. With that we want to fail every test when the console throws a warning
// cypress/support/commands.js
import { mount } from 'cypress/vue';
Cypress.Commands.add('mount', mount);
// cypress/component/my-component.cy.js
import { registerHooks } from '../utils.js';
import myComponent from '@/My-Component.vue';
...
registerHooks(cy);
...
cy.mount(myComponent);
// cypress/utils.js
beforeEach(() => cy.window().then(window =>
{
cy.stub(window.console, 'warn', warning =>
{
throw new Error(warning);
});
}));
Here are an excerpt from my package.json with all installed exact versions. I still get the Warning
"devDependencies": {
"@babel/core": "7.18.5",
"@babel/preset-env": "7.18.2",
"@cypress/code-coverage": "3.10.0",
"babel-loader": "8.2.5",
"babel-plugin-istanbul": "6.1.1",
"clean-webpack-plugin": "4.0.0",
"copy-webpack-plugin": "11.0.0",
"css-loader": "6.7.1",
"cypress": "10.1.0",
"eslint": "8.17.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-cypress": "2.12.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-quasar": "1.1.0",
"eslint-plugin-vue": "9.1.1",
"eslint-webpack-plugin": "3.1.1",
"html-webpack-plugin": "5.5.0",
"mini-css-extract-plugin": "2.6.0",
"process": "0.11.10",
"sass": "1.52.3",
"sass-loader": "13.0.0",
"start-server-and-test": "1.14.0",
"style-loader": "3.3.1",
"vue-loader": "17.0.0",
"webpack": "5.73.0",
"webpack-bundle-analyzer": "4.5.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.9.2"
},
"dependencies": {
"buffer": "6.0.3",
"core-js": "3.22.8",
"dotenv": "16.0.1",
"flat": "5.0.2",
"lodash": "4.17.21",
"moment": "2.29.3",
"vue": "3.2.37",
"vue-router": "4.0.16",
"vuex": "4.0.2",
"vuex-map-fields": "1.4.1",
"vuex-persist": "3.1.3",
},
Confirmed this can be found to be logged even our own tests, like packages/launchpad/src/setup/OpenBrowserList.cy.tsx
, so this is good to go for the team to pick up.
It looks like we can avoid this by not using the runtime-only
build (https://vuejs.org/guide/scaling-up/tooling.html#project-scaffolding) or by changing how we pass compilerOptions
.
I am no longer able to reproduce this:
Current behavior
If i mount a vue-3-component
I get a vue-warning:
I have researched on this in the code and found out that it happens when mounting the app in cypress-vue