Jest : Testing for type or null

I have a test where i want to test if my received object value types match a schema. Prob is that for some keys i may receive something or null I tried this so far const attendeeSchema = { ...

using absolute paths in typescript for imports

my directory structure is: | |__src | |_components | | | |_A | |_index.tsx | | tsconfig.json package.json I want to import A like this: import {...

How can I enable react-i18n translation file to be used in the unit tests done with react-testing-library and jest?

I am making unit tests with jest and react-testing-library for my frontend application which is done with React. My unit tests worked nicely before I added the internationalization with...

ESLint: 'cy' is not defined (Cypress)

I've just started using Cypress with my React Typescript project. I've gotten some simple tests to run: describe('settings page', () => { beforeEach(() => { ...

Cypress causing type errors in jest assertions

I had been using react-testing-library as well as @testing-library/jest-dom/extend-expect. I installed Cypress yesterday, and now I'm getting Typescript errors on all my jest matchers: Property...

React Native: App crashes on start due to SoLoader issue

I'm having issues with my app on Android (iOS is running fine). Every time I do the build, when I open the application it closes before starting. I have tried many solutions that I have been...

Angular 9 production build with webpack

I have an Angular application that I regularly update and build with the latest Webpack bundler. Some days ago I upgraded the project to Angular 9 and encountered some issues that I couldn't...

error: bundling failed: TypeError: Cannot read property 'transformFile' of undefined, React Native

I receive this error whenever I run react-native start, but this started happening recently after I had installed firebase-tools and stripe in my node modules, but before that it would run just...

"serve -s build" returns "serve: command not found"

I cloned a react project, which was probably developed under pure Windows, into WSL of my windows. It seems that, to launch a react app properly in IE and Edge, we need to build the project and...

Mongoose $push typescript errors

It seems like some package upgrade with mongoose or @types/mongoose is now causing new typescript errors from mongoose $push, $pull, $addToSet, and $each operators. For example: await...

yarn test(jest) finds no tests with create-react-app

I am fairly new to automated testing in JavaScript and wanted to include Jest in my work. I followed a simple guide for Jest-Testing in create-react-app. When I try to run my test with yarn test,...

Pact dependency stopping tests being run

Pact depends on a package called make-error-cause. In its index.js it declares a method, then a var immediately afterwards with the same name. Jest/Typescript does not like this. NOTHING we do...

React + Typescript error on build in node_modules/jest-diff/build/diffLines.d.ts

i am currently working on a project that uses React and Typescript that was working just fine until lately where the following error happened on when building using Jenkins (and the error appears...

Line 0: Parsing error: Cannot read property 'map' of undefined

Currently starting up the server on my client side, the error above is what I have been getting. I am using Typescript, React, ESlint. I can't seem to go forward since this error has been...

Jest typescript check for type

lets say i have the following interface: export interface CMSData { id: number; url: string; htmlTag: string; importJSComponent: string; componentData:...

How to solve this MERN stack filebase64 error?

import FileBase from 'react-file-base64'; I get an error after I hover the triple dot indicator in VS Code. My setup has already been successful (other input fields have successfully inserted on...

ng-bootstrap: ngb-datepicker initial value with angular reactive form group is not getting set

I am working with ngb-datepicker which is working fine if no initial values or predefined values are set but when trying to use it formControlName or with [(ngModel)] with an existing...

Metro bundler: Error: EISDIR: illegal operation on a directory, read

When I reload my bundle this exception is uncaught: Error: EISDIR: illegal operation on a directory, read at Object.readSync (fs.js:592:3) at tryReadSync (fs.js:366:20) at...

Eslint behaves differently between local and CI

It seems that eslint behaves different in GitHub actions and in local. On local I don't get any errors a part from ts warning which are fine. Wheres in the github actions I seems to get more...

Conflicts in React dependency tree

When running the react app I got this error in console - SharedArrayBuffer will require cross-origin isolation as of M91, around May 2021. See...

Create-react-app css modules with typescript: Cant resolve .module.css

I am trying to use css modules with typescript and create-react-app react app. I did import './App.modules.css'; in my App.tsx but I get the error: Module not found: Can't resolve...

Jest encountered an unexpected token for NUXT typescript

have been searching for two days, tried many answers, but couldn't find a solution. any clue? below are my config files. please any help? jest.config.js module.exports = { moduleNameMapper: { ...

waitFor times out after calling renderHook()

I am trying to test a simple custom hook: export const getSearchResults = async (searchText: string) => { const { data } = await axios.get(`${BASE_URL}/search`, { params: { ...

Nestjs Error: Failed to execute command: npm install --silent I

I tried to install a new nest project via cli for the first time and it abort after a few seconds after choosing the package manager. Error: Failed to execute command: npm install --silent I...

node-fetch 3.0.0 and jest gives SyntaxError: Cannot use import statement outside a module

I'm trying to upgrade my api to use node-fetch 3.0.0. Part of the breaking changes in their documentation is that node-fetch is now a pure ESM...

Craco unable to build react app when Deployed in Heroku

Been at it for two days and stumped.. tried every solution I can find on stackoverflow. Trying to deploy my MERN stack app with tailwind on Heroku. It seems Craco/tailwind is giving me...

ESlint - Error: Must use import to load ES Module

I am currently setting up a boilerplate with React, Typescript, styled components, webpack etc. and I am getting an error when trying to run eslint: Error: Must use import to load ES Module Here...

Jest tests passing locally but failing in Github actions with TypeError: expect(...).toBeInTheDocument is not a function within github Actions

I am testing my application with React-Testing-Library and Jest within Typescript. My tests are running and passing within my local VS code environment but in the same tests that I have setup...

Property 'exact' does not exist on type

I am trying to use react-router-dom inside my react app and also I am using typescript instead of javascript. The issue here is that I can't import Route inside my and make it work. I already...

console.error Error: Could not parse CSS stylesheet

I'm having the follow error when running my tests with jest. console.error Error: Could not parse CSS stylesheet at exports.createStylesheet...