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
1answer
47 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: ...
1
vote
1answer
61 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 ...
1
vote
1answer
378 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.
0
votes
0answers
547 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 ...
1
vote
1answer
224 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,{ ...
1
vote
1answer
387 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 ...
1
vote
1answer
301 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 ...
6
votes
1answer
4k 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 ...
2
votes
1answer
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 ...
3
votes
1answer
5k 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 ...