All Questions
33
questions
18
votes
1
answer
11k
views
Angular + Jest: Can't resolve all parameters for AppComponent: (?)
I am operating inside a Typescript Monorepo. I want to add an Angular 8 frontend with Jest testing to the Monorepo. But I am encountering some issues.
I am using
Angular CLI: 8.3.5
What I did
I ...
17
votes
3
answers
10k
views
Jest Projects in a Monorepo unable to find config files in projects
Having trouble setting up jest projects.
Project A has some additional configuration that it runs (setupJest, creates some custom matchers, etc) that project B does not have. When I run jest I get ...
16
votes
2
answers
18k
views
Where to configure jest in a monorepo?
I am setting up a monorepo in which I am building a react app where I will be using typescript. We want to use jest to test backend features and React-Testing-Library to test frontend features. Should ...
12
votes
2
answers
14k
views
@nrwl/nx angular Run all test for coverage in a single test run to get all covered code in my mono repo
I'm running tests in multiple projects of my nx angular monorepo and would like to get a single code coverage report of all projects with all code files covert from the tests. The test-runs seems to ...
8
votes
2
answers
10k
views
Jest: "Directory in the roots[0] option was not found"
I am trying to set up monorepo to run all of its Jest tests at once. In each package, I'm using react-app-rewired to get Babel to transpile code imported from other packages without ejecting from ...
7
votes
1
answer
5k
views
Jest with tyescript in monorepo doesn't work with dependency out of the root folder
I use Jest with Typescript. I want to create a monorepo.
My folders structure is:
fe
|-app1
|--.jest.config.ts
|--tsconfig.json
|-shared
|--dummyData.ts
I want a unit test from app1 to access some ...
6
votes
2
answers
2k
views
Target monorepo root directory in jest config within monorepo package
I have the following file structure in my monorepo
📦monorepo
┣ 📂node_modules
┣ 📂packages
┃ ┣ 📂package-1
┃ ┃ ┗ 📜jest.config.js
┃ ┣ 📂package-2
┃ ┃ ┗ 📜jest.config.js
┃ ┣ 📂package-3
┃ ┃ ┗ �...
5
votes
1
answer
11k
views
Jest Testing with Bazel Throws "Module ts-jest in the transform option was not found"
I have a working Bazel BUILD file that looks like this:
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@...
5
votes
2
answers
8k
views
jest coverageDirectory configuration for project inside monorepo
I have a typescript monorepo with jest. Their jest.config.js is
module.exports = {
clearMocks: true,
projects: ['<rootDir>/packages/**/jest.config.js'],
collectCoverage: true,
...
4
votes
1
answer
607
views
Mock Lerna scoped module with Jest
I have a monorepo setup with Lerna. The project is compiled with tsc and the tests are ran with ts-jest v27.
One of the files that I'm trying to test has this code:
import { someFunction } from '@...
3
votes
1
answer
550
views
Cannot find module '@foo' with ts-jest and monorepo
I have a monorepo utilizing TypeScript, WebPack, and ts-jest. It builds correctly but unit testing fails on one of the sub-projects ./demo due to:
Cannot find module '@mlhaufe/graphics/adapters' or ...
3
votes
0
answers
2k
views
How to properly configure jest unit and component tests in React Native monorepo with TypeScript
So, my issue is a bit difficult to descibe because our repository (which is at work, so I unfortunately can't just provide a link to it) is pretty big and complex, but I'll do my best. First of all, ...
2
votes
1
answer
11k
views
Jest TypeError: Cannot read properties of undefined (reading 'html') at new JSDOMEnvironment
I've setup a monorepo with Node.js and React.
Trying to configure jest to run test suites the api Node works fine but I got the following error on the client side:
FAIL client/src/App.test.tsx
● ...
2
votes
2
answers
2k
views
Jest tests fail after using 'csv-parse/sync' lirbary
I am using NestJs with Nx.dev for monorepo. After I installed csv-parse/sync and used my Jest tests don't work anymore.
Jest encountered an unexpected token
Jest failed to parse a file. This happens ...
2
votes
2
answers
677
views
Prevent Duplicating Typescript Path Configurations in Monorepo
Gist
I like to follow the "dry" (don't repeat yourself) principle. But currently I have nearly the same path configuration in three different places:
1. Typescript config file
I have a monorepo ...
2
votes
0
answers
264
views
Problems configuring ts-jest with package dependencies in a monorepo
I am having problems with configuring ts-jest in a monorepo with packages that depend on each other. Things work great with esbuild and tsc but not with jest and ts-jest.
I am able to get all the ...
2
votes
0
answers
407
views
Jest in Turborepo with yarn workspaces: transformIgnorePatterns
I'm trying to target a package called oauth4webapi in my jest.config.ts file in a local turborepo package. The package I'm tryng to target is in the root node_modules folder, not the local one. Is ...
2
votes
0
answers
162
views
How to mock node modules from subdirectories in the root directory of a monorepo?
I am using jest with typescript, and currently have a monorepo with a structure like this:
root
|-service1
|--.jest.config.ts
|--package.json
|--tsconfig.json
|-service2
|--.jest.config.ts
|--package....
2
votes
0
answers
359
views
NX monorepo testing with jest: "SyntaxError: Unexpected token 'export'" for local lib
We have recently moved a project with nestJS and React into a Nx Monorepo.
We have converted some parts into libs so we can reuse them easily. This all works nice except when testing. When I run npx ...
2
votes
0
answers
405
views
nx jest cannot find module `./.config/babel.config`
I have an app inside my nx project, which uses array-move.
When writing a test for this app, jest crashes with:
Details:
.../node_modules/array-move/index.js:1
({"Object.<...
2
votes
0
answers
203
views
How to get create-react-app test in a typescript (babel) based monorepo
I've taken the example at
https://github.com/serhii-havrylenko/monorepo-babel-ts-lerna-starter, (lerna, yarn workspaces, typescript and babel transpilation based monorepo) and added a create-react-...
1
vote
1
answer
874
views
Typescript Build Fails When Adding Angular into Monorepo (Clashing of Jasmine and Jest Types)
Gist
I have a Monorepo with solely Typescript packages. When I run tsc --build all packages will be compiled to Javascript. This worked fine until I added a package containing an Angular app.
For ...
1
vote
1
answer
1k
views
Configuring jest, wallabyjs in a rush monorepo
I'm attempting to set up a monorepo using rush for monorepo management, jest as my test framework, and wallabyjs as my test runner. When I attempt to start wallaby, I get the error [Error] Automatic ...
1
vote
1
answer
2k
views
Running jest in a monorepo with create-react-app packages
Here is a question.
I'm trying to merge some of my packages into a monorepo. I'm using yarn and it's workspaces-experimental feature. So the repository folder structure looks like:
.
node_modules
...
1
vote
1
answer
464
views
Test suite failed to run...Cannot find module '../build/Release/canvas.node'
Jest is not able to find the package canvas in dependencies even though it is present. yarn run test is failing with the following error.
packages/first/src/layouts/EventsTable.spec.tsx
● Test suite ...
1
vote
0
answers
101
views
Expo monorepo with react-navigation
I have tried to create a monorepo containing two Expo apps using React Navigation with different SDK levels and I forced it to use nohoist for all
"workspaces": {
"packages": ...
1
vote
1
answer
937
views
gitlab-ci jest in monorepo with interdependencies
Im using jest to run tests in my monorepo.
These tests have interdependencies to other subpackages of the monorepo.
Everything works great localy.
But the gitlab-ci pipeline fails, cause it cant ...
0
votes
2
answers
1k
views
JEST: unit tests are successful although an unknown component is used
Why does the unit test not fail locally even though a component is used that does not exist but in bitbucket pipeline it does?
To demostrate the problem I have created a new nx workspace (Repository).
...
0
votes
0
answers
634
views
How can I point to repository root directory in jest config file?
I have a monorepo managed by nx. I have a jest.preset.js file in the repository root directory. There is Reporters configuration in that file as below:
reporters: [
'default',
[
'<...
0
votes
0
answers
392
views
Turborepo/Monorepo multiple jest versions
I've got a turbo repo with two folders, apps and libs. Inside libs I have several packages. I'm trying to upgrade the packages in libs to a newer version of jest one at a time, but I'm struggling to ...
0
votes
1
answer
182
views
Support for the experimental syntax 'jsx' isn't currently enabled in monorepo
I currently have 2 packages in my monorepo
web-ui & testing-utils
testing-utils
package.json
{
"name": "@testing-utils",
"version": "1.0.0",
"...
0
votes
0
answers
1k
views
JEST - SyntaxError: Unexpected token 'export'
I have a monorepo with 3 packages, namely:
web-app: A NextJS 12 project in Typescript
web-core: A redux-toolkit project used in web-app
web-ui: A storybook project with components which are being ...
0
votes
1
answer
875
views
Mock an internally used function from a sub package with Jest
I have a Lerna monorepo, a @project/shared-component sub package and a @project/consumer sub package. The @project/shared-component package exposes a SharedComponent react component, which internally ...