Closed antoniolofiego closed 8 months ago
Hey @antoniolofiego, thanks for opening this issue! Can I ask you to provide more information:
Also, is the problem you have that you can't run the tests? If yes, can you please paste here the failure description?
Thank you for that!
Hey @antoniolofiego, thanks for opening this issue! Can I ask you to provide more information:
- RequestID (you can click on CodiumAI logo in the upper left side of the panel and choose "Copy Request ID")
- If you can provide the code you are trying to fix / screenshot of the results
Also, is the problem you have that you can't run the tests? If yes, can you please paste here the failure description?
Thank you for that!
Hey @almog-lv, here are the details.
Request ID: 13474a24-26a4-4ee0-9cc7-095500732de6
This is the generated test:
it('should render children when flag is enabled', () => {
// Mock the useFlags function to return a flags object with the specified flag set to true
jest.mock('../services/launchDarkly', () => ({
useFlags: jest.fn(() => ({ [flag]: true })),
}));
// Import the component
const { FeatureFlagWrapper } = require('../components/FeatureFlagWrapper');
// Render the component with the flag enabled
const { getByText } = render(
<FeatureFlagWrapper flag={flag}>
<div>Children</div>
</FeatureFlagWrapper>
);
// Assert that the children are rendered
expect(getByText('Children')).toBeInTheDocument();
});
The key error is that it's generating Jest code when the configuration is for Vitest, screenshot here.
I'm not even offered Vitest in the config screen anymore. I can set it in the config file but it's ignored.
Hey @james-gough-op thanks for reporting, Vitest is relatively new, and current AI models, including ours, did not have Vitest data in their training set. It will probably be resolved in the 2-3 months with newer models, but in the meantime we removed Vitest from the list of possible frameworks. It will be added back once it will be supported.
Independently of the test framework I choose (my target is Vitest), all the tests are generated using Jest and consequently fail, even after fixing and retrying. Tried with multiple functions, multiple files and multiple combinations of other options.