We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using v-bind in css styles creates an html output that includes the absolute path:
Component with a style binding:
<template> <div> hello </div> </template> <script setup> const margin = ref('40px') </script> <style scoped> div { margin: v-bind(margin); } </style>
Then using jest snapshots:
import { shallowMount } from '@vue/test-utils' import Component from './Component.vue' it('renders correctly', () => { wrapper = shallowMount(Component) expect(wrapper.html()).toMatchSnapshot() })
The snapshot created:
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders correctly 1`] = ` "<div style="--/Users/alvaro/Documents/test-project/Component.vue-margin: 0;"> hello </div>" `;
The snapshot shouldn't contain the absolute path, so it doesn't break between machines:
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders correctly 1`] = ` "<div style="--Component.vue-margin: 0;"> hello </div>" `;
The snapshot contains an absolute path, so running the same test on a different path/machine will fail.
Name the CSS variable differently.
The text was updated successfully, but these errors were encountered:
@alvaromat Have you fixed it?
Sorry, something went wrong.
This is not a part of @vue/test-utils. The error is caused on SFC transform for Jest by @vue/vue3-jest. See:
@vue/test-utils
@vue/vue3-jest
No branches or pull requests
Subject of the issue
Using v-bind in css styles creates an html output that includes the absolute path:
Steps to reproduce
Component with a style binding:
Then using jest snapshots:
The snapshot created:
Expected behaviour
The snapshot shouldn't contain the absolute path, so it doesn't break between machines:
Actual behaviour
The snapshot contains an absolute path, so running the same test on a different path/machine will fail.
Possible Solution
Name the CSS variable differently.
The text was updated successfully, but these errors were encountered: