swc-project / swc-project/pkgs

[Issue with @swc/jest] `exclude` property being ignored

Open
#86 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
86
Forks
44
Avg merge
3d 49m
Merged PRs (30d)
1

Description

I have a .swcrc file that has a exclude like

"exclude": [
    "src/tests",
    "src/migrations",
    "\\..*spec\\.ts$"
  ]

because I don't want the build to have the test files, but when trying to replace the exclude in the jest.config.ts file like this

transform: {
    '^.+\\.(t|j)s$': ['@swc/jest', {
      ...swcConfig,
      sourceMaps: 'inline',
      exclude: [],
    }],
  },

When running the tests everything fails due to this error

cannot process file because it's ignored by .swcrc

If I remove the exclude from the .swcrc file everything works as expected.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the .swcrc and jest.config.ts configurations shown in the issue, then run the affected Jest tests through @swc/jest. Trace how the exclude setting is read and overridden; done means the Jest configuration can override the .swcrc exclusion without producing “cannot process file because it's ignored by .swcrc”.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.