Questions tagged [jestjs]

Jest is a JavaScript unit testing framework made by Facebook that's based on Jasmine and provides automated mock creation, and a jsdom environment. It's often used for testing React components.

Filter by
Sorted by
Tagged with
1 vote
1 answer
60 views

validated variable is present and datatype assertion using Jest testing

I have 2 files as below admin.js const mongoose = require("mongoose"); const Schema = mongoose.Schema; const Schema = new Schema({ User: { type: String, unique: true }, Pass: { type: ...
user avatar
  • 21
1 vote
1 answer
110 views

Accessibility testing at the unit level

I know there's plenty of tools out there to look at a fully available web page for accessibility issues, but what about for doing earlier unit testing? The application I'm testing involves Angular and ...
user avatar
  • 255
1 vote
1 answer
1k views

How to re-run jest failed test suite [closed]

I want to re-run the whole test suite when any test has status failed. I only found how to re-run the test case but I want to re-run the whole test suite.
user avatar
0 votes
0 answers
804 views

How can I mock location.pathname in reactjs

I tried all the possibilities to mock location.pathname This is my code if(typeof location !== undefined) { this.setParentPath(location.pathname); } This is one of the possibility I used to cover ...
user avatar
1 vote
1 answer
569 views

Testing nodejs gRPC client functions

I have a task to test gRPC client call functions with Jest. Here is what a whole thing looks like: We import a package from proto file: const packageDef = protoLoader.loadSync(PROTO_PATH,{ ...
user avatar
2 votes
1 answer
677 views

Typescript function not waiting for the waitForExist() and printing the next line

I'm using webdriverIO with typescript and jest to automate react application. I have a simple test to check how long it takes for a particular element to display on the screen. There's a process ...
user avatar
  • 49
1 vote
1 answer
526 views

How to wait till next page opens after a button click in Jest + TypeScript?

I want to pass or fail the tests of "Login" function based on fields available on the second page. I used "xpath" to capture the fields. But it does not capture the fields of the second page. I ...
user avatar
  • 21
7 votes
1 answer
5k views

Is there a way to run a subset of tests using Jest?

I would like to be able to run a subset of it's or describe's in a Jasmine test file using jest with some type of tagging system. I know I can indicate a filter of sorts by using a word after the ...
user avatar
  • 147
2 votes
1 answer
5k views

Wait for element change not present (WebDriver/JavaScript/Jest)

Yesterday I struggled with waiting for a loading indicator to be removed. Added this question and answer here because we spend a lot of time on it and Google didn't help much. Hopefully this will help ...
user avatar
3 votes
1 answer
6k views

Rerun failed (flaky) tests with Jest

We are using Jest as our test runner for our JavaScript (React and Selenium) tests. We have one or two flaky tests (as TeamCity marks them flaky and we process them as technical-debt), although we ...
user avatar