blitz-js / blitz-js/legacy-framework

Cannot override or append to `testPathIgnorePatterns` in jest setup

Open
#11 4 comments 1 reaction 0 assignees View on GitHub
kind/bug legacy-framework status/ready-to-work-on
Dominant language
JavaScript
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### What is the problem?

I have an internal module for deploying some AWS units, this internally have their own tests, when running `yarn test` with blitzjs, the tests inside the `aws` folder are picked up, which is undersirable (since they have their own compilation target/config)

I've tried setting `testPathIgnorePatterns` in the `jest.config.ts` file but it doesn't seem to be working, no matter what I do my tests are still picked up, could this be a problem with the blitz jest preset?

### Paste all your error logs here:

```
$ yarn test
yarn run v1.22.17
$ jest
Determining test suites to run...Loaded env from /Users/osp/Developer/productlane/.env.test.local
Loaded env from /Users/osp/Developer/productlane/.env
PASS SERVER app/projects/queries/getProjects.test.ts
#getProjects
✓ get (13 ms)

PASS CLIENT app/pages/index.test.tsx
✓ Renders home page with Sign up button (35 ms)

FAIL CLIENT aws/test/aws.test.ts
● Test suite failed to run

Your test suite must contain at least one test.

at onResult (node_modules/@jest/core/build/TestScheduler.js:175:18)
at node_modules/@jest/core/build/TestScheduler.js:304:17
at node_modules/emittery/index.js:260:13
at Array.map ()
at Emittery.Typed.emit (node_modules/emittery/index.js:258:23)

Test Suites: 1 failed, 2 passed, 3 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 2.859 s, estimated 3 s
Ran all test suites in 2 projects.
error Command failed with exit code 1.
```

### Paste all relevant code snippets here:

```
import type { Config } from "@jest/types"

const config: Config.InitialOptions = {
preset: "blitz",
testPathIgnorePatterns: ["/aws/"],
clearMocks: true,
verbose: true,
}

export default config

```

### What are detailed steps to reproduce this?

1. Create a subfolder with tests
2. Try to ignore the subfolder in the jest config
3. Jest should skip the specified folder

### Run `blitz -v` and paste the output here:

```
$ blitz -v
Loaded env from /Users/osp/Developer/productlane/.env.local
Loaded env from /Users/osp/Developer/productlane/.env
macOS Monterey | darwin-arm64 | Node: v16.12.0

blitz: 0.44.0 (global)
blitz: 0.44.4 (local)

Package manager: yarn
System:
OS: macOS 12.1
CPU: (8) arm64 Apple M1
Memory: 216.25 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.12.0 - ~/.nvm/versions/node/v16.12.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.12.0/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.12.0/bin/npm
Watchman: 2021.11.15.00 - /opt/homebrew/bin/watchman
npmPackages:
@prisma/client: 3.6.0 => 3.6.0
blitz: 0.44.4 => 0.44.4
prisma: 3.6.0 => 3.6.0
react: 18.0.0-beta-149b420f6-20211119 => 18.0.0-beta-149b420f6-20211119
react-dom: 18.0.0-alpha-5ca4b0433-20211020 => 18.0.0-alpha-5ca4b0433-20211020
typescript: ~4.5 => 4.5.2
```

### Please include below any other applicable logs and screenshots that show your problem:

Screen Shot 2021-12-26 at 10 58 24

Contributor guide

Open the contributing guide

Research direction

Start with jest.config.ts and run yarn test to reproduce the failure from aws/test/aws.test.ts. Inspect how the blitz Jest preset handles testPathIgnorePatterns and confirm that the aws folder is skipped while the existing app/projects and app/pages suites still run.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, 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.