Category "jestjs"

How do I get text from input text box in selenium?

I need to insert with selenium to text box and then get it to another use. how can I do this? The function getText() doesn't work.

how to integrate jenkins with react jest testing results

My project is using reatJS, jest is used to do unit test and also to generate the coverage report. Now I need to use jenkins to automatically build the project

jest unit test mock google oauthClient in nestjs

I am currently doing unit test for the services in Nestjs using Jest, one of which is using the google Oauth service. My goal is to verify the token from google

Is there any way to mock private functions with Jest?

The ES6 module that I want to test looks as follows: function privateFunction() { ... } export function publicFunction() { ... does something ... priva

Jest Angular svg template

I have several components in my Angular 9 app that have their templates defined in svg file like templateUrl: './eye.component.svg'. When I run tests it errors

Node v13 / Jest / ES6 — native support for modules without babel or esm

Is it possible to test ES6 Modules with Jest without esm or babel? Since node v13 supports es6 natively have tried: //package.json { … "type": "modu

_vuex.default.store is not a constructor

I'm trying to test a component that uses vuex inside it, I'm trying to pass the store of the respective component so that it can be assembled, but I'm getting t

how to pass screen.height & screen.width in vue test case | Jest Framework

I have used screen.height & screen.width for js operations. I can't able to pass the test case. (code coverage). I am using vue utils - Jest framework. belo

How to disable Morgan (request logger) during unit test?

I use Morgan (default express generator request logger), and I'm trying to disable it during unit testing. Currently I'm using the default configuration, which

Jest - SyntaxError: Cannot use import statement outside a module

I am using jest:24.9.0 without any configuration, installed globally from a create-react-app. Inside these files I am using es6 modules. There is no error when

Trigger useEffect in Jest and Enzyme testing

I'm using Jest and Enzyme to test a React functional component. MyComponent: export const getGroups = async () => { const data = await fetch(groupApi

How to pass a an argument to getByText in react Testing Library?

Currently I'm doing this getByText(/SomeText/i); But I want to make a function and pass some text as an argument by first storing it in a variable. I tried doi

Jest: function that should throw does not pass and test will fail

I want to test a function A that calls multiple other functions inside it which can throw errors. Here is an abstraction of my code: // file A.ts const A = (ar

Jest: function that should throw does not pass and test will fail

I want to test a function A that calls multiple other functions inside it which can throw errors. Here is an abstraction of my code: // file A.ts const A = (ar

How can I mock Webpack's require.context in Jest?

Suppose I have the following module: var modulesReq = require.context('.', false, /\.js$/); modulesReq.keys().forEach(function(module) { modulesReq(module);

How to mock a ES6 singleton class with Jest?

I have a dependency that is a singleton class like so: // dependency.js class Dependency { foo() { ... } } export default new Dependency(); I'm trying to

Stencil unit testing: How to mock initial state and load newSpecPage?

I am new to unit testing and planning to write unit test cases but not E-2-E for the below mentioned scenario and playgrounnd link for scenario is at the bottom

Testing asynchronous useEffect

My functional component uses the useEffect hook to fetch data from an API on mount. I want to be able to test that the fetched data is displayed correctly. Whi

Jest testing react component with react-intersection-observer

I'm trying to test a component that has a child component that includes react-intersection-observer but I always get an error I tried to import the library bu

jest with vue3 typescript TypeError: Cannot read property 'deep' of undefined

I am doing unit test using jest. The things I am working with is vue3 (typescript) with quasar. I am facing the following error: TypeError: Cannot read property