Categories
Mastering Development

Property ‘toBeInTheDocument’ does not exist on type ‘Matchers

Trying to setup testing for a components library. I’ve tried many example and all similar threads on this with no luck. My setupTests.ts file is correctly being loaded (proven with a console.log), and the library seems to be available as if I add import { toBeInTheDocument } from ‘@testing-library/jest-dom/matchers’ and log toBeInTheDocument it is present. […]

Categories
Mastering Development

Cannot manage to get Jest working with reactjs

I’m getting the following errors when trying to run npm run test. npm : FAIL src/App.test.js At line:1 char:1 + npm run test + ~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (FAIL src/App.test.js:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError ÔùÅ Test suite failed to run Cannot find module ‘react’ from ‘iconBase.js’ However, Jest was able to find: […]

Categories
Mastering Development

Cannot read property ‘fromJSON’ of undefined while testing in Jest

while running jest i get the following error.I dont know why am i getting this error. TypeError: Cannot read property ‘fromJSON’ of undefined at Object. (node_modules/@grpc/proto-loader/node_modules/protobufjs/ext/descriptor/index.js:3:66) at Object. (node_modules/@grpc/proto-loader/build/src/index.js:23:20) Below is the tsconfig.json { “compilerOptions”: { “target”: “esnext”, “module”: “commonjs”, “outDir”: “dist”, “sourceMap”: true, “moduleResolution”: “node”, “declaration”: true, “experimentalDecorators”: true, “allowSyntheticDefaultImports”: true, /* Allow default […]

Categories
Mastering Development

Cannot load .js file in webpack

I want to use a package that I installed with npm install in my React project. But when I import a component from the package like this in index.jsx: import Header from “material-kit-react/src/components/Header/Header”; I am getting the following error message in the webpack builder: ERROR in ./node_modules/material-kit-react/src/components/Header/Header.js 63:25 Module parse failed: Unexpected token (63:25) You […]

Categories
Mastering Development

TypeScript metadata reflection references other classes before they are defined

I have some TypeORM entities in my codebase which have relations to each other, making a circular dependency. Since decorator metadata is used on each entity class, TypeScript inserts code after each class defining metadata on it. Say that the classes are Business and Qualification. On the relating fields TypeScript will emit code that looks […]

Categories
Mastering Development

Error: Cannot find module ‘ejs’, webpack does not compile the ejs module in the bundle.js file made through webpack.server.js

I keep getting the not found module for ejs and tried bunch of solutions. I am not sure why the ejs module does not compile to the file webpack builds. this is the error: Error: Failed to lookup view “pages/index” in views directory “/views” at Function.y.render (/Users/”user name”/projects/project-node-test/build/bundle.js:277:4330) package.json: “name”: “project-node”, “version”: “1.0.0”, “description”: “”, […]

Categories
Mastering Development

How to test react navigation authentication flow?

I’m developing a React Native application. I’m doing something like what’s explained here to implement the authentication flow. So, I created an AppContainer that looks like this: import {createAppContainer, createSwitchNavigator, createStackNavigator} from “react-navigation”; import AuthLoadingScreen from “../screens/auth/auth-loading-screen”; const AppStack = createStackNavigator({ Home: {screen: HomeScreen} }); const AuthStack = createStackNavigator({ SignIn: {screen: SignInScreen} }); const AppContainer […]

Categories
CMS Development Wordpress

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren’t familiar with some of the nuances of javascript, are completely new to Gutenberg development, and yet need to tweak […]

Categories
CMS Development Wordpress

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren’t familiar with some of the nuances of javascript, are completely new to Gutenberg development, and yet need to tweak […]

Categories
Mastering Development

Running webpack build issue while trying to create a React application using babel, webpack

I am working on a new project set up for react using webpack and babel. Following is the webpack.config.js file Folder structure: node_modules/ src/ – api/ – components/ – index.jsx – stats.html webpack.config.js babel.config.js const path = require(‘path’); const MiniCssExtractPlugin = require(‘mini-css-extract-plugin’); const { BundleAnalyzerPlugin } = require(‘webpack-bundle-analyzer’); const { ContextReplacementPlugin, HashedModuleIdsPlugin } = require(‘webpack’); […]