Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

/* istanbul ignore next */ not working #152

@rikisamurai

Description

@rikisamurai

I have added /* istanbul ignore next */ , but it doesn't work.
here is my project: https://github.com/rikisamurai/swc-jest-issue. You can reproduce the issue by running the command pnpm test
version:

    "@swc/cli": "^0.1.62",
    "@swc/core": "^1.3.68",
    "@swc/jest": "^0.2.26",
    "jest": "^29.5.0",

swc/jest doesn't ignore export const countAtom = atom(0);

source code

import React from 'react';
import { atom, useAtom } from 'jotai';

/* istanbul ignore next */
export const countAtom = atom(0);

export function Counter() {
    const [count, setCount] = useAtom(countAtom);

    return (
        <h1>
            <p>{count}</p>
            <button onClick={() => setCount(c => c + 1)}>one up</button>
        </h1>
    );
}

jest config:

const swcConfig: SWCConfig = {
  sourceMaps: true,
  jsc: {
    preserveAllComments: true,
  },
};
const config: JestConfig = {
    testEnvironment: 'jsdom',
    transform: {
        '^.+\\.(t|j)sx?$': ['@swc/jest', swcConfig as Record<string, unknown>],
    },
    rootDir: './',
    collectCoverage: true,
    coverageReporters: ['clover', 'json', 'lcov', 'text'],
    setupFilesAfterEnv: ['<rootDir>src/setupTests.ts'],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions