Vitest Coverage UI doesn't clear up tested lines

54 Views Asked by At

I'm having a problem with npm run test-coverage-ui. Stated here are tests I did for the component:

it('should render SPALoadingShimmer', () => {
    //arrange
    const { getByTestId } = setupComponent(
      EmployeeProfileCompAndBenBankDetailsCard,
      renderComponents,
      {
        employeeProfile: {
          ...defaultStore,
          loader: {
            content: true,
          },
        },
      },
      router
    );
    //assert
    expect(
      getByTestId('bank-details-card-shimmer')
    ).toBeInTheDocument();
  });
  it('should not render SPALoadingShimmer', () => {
    //arrange
    const { getByTestId } = setupComponent(
      EmployeeProfileCompAndBenBankDetailsCard,
      renderComponents,
      {
        employeeProfile: {
          ...defaultStore,
          loader: {
            content: false,
          },
        },
      },
      router,
      props
    );
    //assert
    expect(
      getByTestId('bank-details-card-container')
    ).toBeInTheDocument();
  });

But when I look at the Coverage UI localhost, the lines of code that corresponds to the tests are in red (not tested). Earlier while I was testing, it is already covered but somehow after awhile it turned red. I didn't do anything about the configurations.Coverage UI lines of code

0

There are 0 best solutions below