jest-css-modules-transform icon indicating copy to clipboard operation
jest-css-modules-transform copied to clipboard

jest-css-modules-transform-config.js not read

Open thplat opened this issue 2 years ago • 2 comments

I have created the jest-css-modules-transform-config.js in the root of my package, however it does not seem to be honored.

Contents of the config file:

module.exports = {
    injectIntoDOM: true,
    prepend: [
        './src/scss/vue-ui.scss',
    ],
};

Example Test:

import { shallowMount, mount } from '@vue/test-utils'
import Select from '@/components/Forms/Select.vue'
import colors from '@/scss/_base_js.scss';

describe('Select.vue', () => {

  const wrapper = mount(Select, {
    propsData: {
      options: ['Option A', 'Option B'],
      value: 'Option A'
    }
  });

  it('has the brand brand color', () => {
    console.log(getComputedStyle(wrapper.element));
    //expect(wrapper.element).toHaveStyle({background: colors.brandColor});
  });
})

The computed styles are empty and the css does not seem to be injected into the DOM. Am I doing something wrong here? I also tried to manually set the path via the JEST_CSS_MODULES_TRANSFORM_CONFIG env variable but it seems to have no effect either.

thplat avatar Jul 08 '21 17:07 thplat