Skip to content
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

TypeError: CSS.supports is not a function while running test #136

Open
duytran-orientsoftware opened this issue May 8, 2023 · 1 comment

Comments

@duytran-orientsoftware
Copy link

I met this TypeError: CSS.supports is not a function when writing a test file for my feature using Codeflask

Screenshot 2023-05-08 at 14 11 41

I also try to bypass this by using global.CSS, but it does not seem to work on my side.

import React from 'react';

import { render, screen } from '@testing-library/react';
import { setupServer } from 'msw/node';

import { defaultConfigurationProps } from '@applets/ImportManager/__helper__/ConfigurationDialogWrapper';
import { setMockAuthToken } from '@util/testhelpers/init';
import NewColumnDialog from '.';
import { setDocumentHeight } from '../../../../../../../config/jest/jestHelpers';
import { AGGREGRATE, LOGICAL, MATHEMATICAL } from './MenuOption';

global.CSS = { supports: jest.fn(), escape: jest.fn() }; // Add this to bypass the CSS.supports is not a function

const server = setupServer();

beforeAll(() => {
	setMockAuthToken();
	server.listen();
});
...etc

Do you guys know any way to resolve or at least bypass this? Thanks.

Version:

  • React: 17.0.2
  • Codeflask: 1.4.1
  • Jest: 29.2.2
  • @testing-library/react: 12.1.5
  • @testing-library/jest-dom: 5.16.5
@Frozen-byte
Copy link

Same Problem for me, for a temporary workaround I added

Object.defineProperty(global.CSS, 'supports', {
    value: () => jest.fn()
});

to my jest setup file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants