Category "mocha.js"

Mocha hook for each test and test file

Is it possible to add a hook in mocha 8.1 for each test and test file? Ex: I want to set a startup delay before each each in all the test files

"Workerpool Worker terminated Unexpectedly" for Mocha tests in CircleCI

I have TypeScript tests running with Yarn and Mocha and they work fine locally. When I deploy via CircleCI, however, I get this: 1) Uncaught error outside test

Command 'Solidity: Compile Contract' resulted in an error (Cannot read properties of undefined(reading 'uri'))

Good day everyone, I am working on a lottery smart contract. I am currently done with the remix VM tests and proceeded with the unit tests with JavaScript. The

Error calling a command based on the number of items within an array

I have the following problem: I want to call my service a number of times. This number of times must be based on the number of times in my array. Below my step

Mocha testing Typescript source file: unable to import node modules

I have setup mocha to test typescript source files. I have successfully run a test on one file that only imported source files, but I'm seeing a failure running

chai-assertion to validate anyone is true should pass

I am trying to do assertion to validate any one statement is true, test should pass. Following is the code expect(commuication.status).to.contain( "PROCESSED",

TypeScript error TS2403: Subsequent variable declarations must have the same type

I seem to be running into some compile errors on my TypeScript project. The full error is: node_modules/@types/mocha/index.d.ts:2680:13 - error TS2403: Subsequ

How to use GLOBAL FIXTURES in mocha JS to prepare preconditions of all test

I have read the document of mocha but can't follow the instruction. Because I have an Express Class like that // ExpressServer.js const http = require('http');

How do I automatically check for '.only' calls accidentally left in Mocha specs?

I occasionally forget to remove .only calls from my Mocha specs before pushing spec changes. Doing so obviously affects test coverage, which requires addressing

Mocha: Hide console.log output from successful tests

My Problem I'm writing a test suite for a Node.js application using Mocha. The functions that I'm testing write their logs to console.log directly, without any

Sinon Spy / Stub for Function inside Function (Private Function)

I'm new Sinon. i'm unable to spy the private ajax function Actual code in library.js function ajax () { console.log("I'm a"); } function getJSON() {

Unit testing for Google Cloud Functions

I was trying to write unit testing for Google Cloud Functions referring to Google Cloud Platform unit testing docs but not able to understand how to mock when G

How do I pass Mocha multiple files by path on the command line?

I am amassing a list of test files which need to be run. I'd like to pass them into Mocha via the command line. My current command looks like this: {here}/no

NestJS Share e2e server between test suites

I'm using NestJS test module to mock the nest app and I want to share this app among various test suites. Here's my setup: test |_ helpers |_ testApp.ts

Mocha + Chai: Continue and try all assertions after failure for the test

I would like the test runner to continue testing the whole it test even after the assertion fails. const { assert } = require('chai'); describe('Test suite', (

Connection Not established in Mocha to MongoDB Atlas

When starting my application it connects to MongoDB Atlas as logged, however, when running mocha tests it does not even try to connect to the DB. here is my ser

For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves

I have this test of nodejs when testing I get a error of done function not declared. Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done

How do I reset Hardhat's mainnet fork between tests?

I'm writing unit tests in Hardhat using Hardhat's mainnet fork, however it seems that the results from one test are affecting future tests and causing my assert

Run mocha excluding paths

I have this (in gulpfile.js): var gulp = require("gulp"); var mocha = require("gulp-mocha"); gulp.task("test", function() { gulp .src(["./**/*_test

How to configure .mocharc.yml to choose exports-style interface?

How to configure .mocharc.yml to choose exports-style interface. It should be like this ___:_____