Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

Error when calling a contract function with web3.js

I'm working on a smart contract test using Ganache and Web3.js. My contract deploys without errors, but when I try to call a function, I encounter an error. Here’s my code: const assert = require('...
Alex's user avatar
  • 1
0 votes
0 answers
17 views

How to mock a node module import in node js

I am using mocha as my testing environment in my node project and Sinon to stub and mock dependencies. I have a File Factory.js as import fs from 'fs' class Factory{ create = async(options) => {...
Saurav Khewal's user avatar
0 votes
0 answers
27 views

How does one get the ID from the response body with Mocha test, then use that ID and delete the item?

I am creating a location on the API, the location gets created but then populates an ID, this ID changes all the time. How do I write my Mocha tests to get the ID of the created location, even though ...
Shams's user avatar
  • 51
0 votes
0 answers
25 views

Issues with Mocking S3 Multipart Upload After Migrating from AWS SDK v2 to v3

I'm trying to run a test. It worked fine with AWS SDK v2, but after migrating to v3 using codemod,I'm facing issues. This is my index.spec.js to test the test using mocha and sinon. My test is getting ...
Adithya sankar's user avatar
0 votes
0 answers
30 views

typeerror: callback is not a function - mocha

I am new to typescript and I have written testcases for databaseHelper class to insert or update date. I am getting callback is not a function error. I am making one call to check if agency exists in ...
CodeGirl's user avatar
0 votes
0 answers
14 views

How to Stubbing Azure Client Using Mocha and chai

const { EventHubConsumerClient, earliestEventPosition } = require("@azure/event-hubs"); const { ContainerClient } = require("@azure/storage-blob"); const { BlobCheckpointStore } = ...
Sanjeev Sahani's user avatar
1 vote
1 answer
35 views

Mocha works when using classes but not on functions

Working through a Mocha section of modules on Codecademy, I thought I was getting it but when i tried to practice on my computer for a basic function, it's not working. Clearly I am missing something ...
Ben Wheatley's user avatar
0 votes
0 answers
19 views

Can I dynamically add a test file in mochajs in browser?

In the documentation I see a connection option. It adds a script to the html page. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> ...
Sergey's user avatar
  • 672
0 votes
1 answer
501 views

How to fix deprecated [email protected] warning on using npm i?

I'm trying to install mocha-junit-reporter 2.0.2 version in my app, which currently uses mocha 10.4.0 version. When I do npm i I get the following error : npm warn deprecated [email protected]: This ...
Hema Murthy's user avatar
0 votes
1 answer
17 views

Mocha test remains running

I'm running mocha tests from node and all of my test cases successfully pass, however, the npm-test command does not terminate once the tests are over. I've simplified my set-up a lot to bring an ...
Banana's user avatar
  • 824
-2 votes
1 answer
47 views

Axios API request fails in Mocha tests but works in postman

Thanks Advance for your responses.. I have been acquiring knowledge on utilizing AXIOS, MOCHA, and CHAI to conduct API automation tests. During my learning journey, I encountered an issue while ...
Anto Else's user avatar
0 votes
0 answers
40 views

Upgraded to Chai 5.x, converted whole node project to ESM modules, test run fails with unhelpful error messages

I have a node server that was originally written in 2018-19 with require and module.exports syntax. I recently upgraded to Chai 5.1, which meant I needed to convert every file in my project to ESM ...
rg_'s user avatar
  • 421
0 votes
0 answers
24 views

chai.request is not a function when I use .js files

I have this libs installed in my package.json: { "name": "22)-tests", "version": "1.0.0", "description": "", "main": "...
Sudo Sur's user avatar
  • 607
0 votes
0 answers
20 views

Issue writing unit tests for a jQuery datepicker plugin

the start of my plugin (function(factory) { if (typeof define === "function" && define.amd) { define(["jquery", "jquery-ui-dist"], factory); } else { ...
Mo1's user avatar
  • 379
1 vote
0 answers
25 views

Mocha fails to use typescript baseUrl setting for ESM imports

I'm trying to get "absolute" import paths working in our mocha test files. These work fine for our Vite/TS React app. import { agent } from 'tests/shared/supertest' I've tried adding ts-node/...
helion3's user avatar
  • 37.1k

15 30 50 per page
1
2 3 4 5
566