Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 09:04
    MylesBorins commented #1317
  • 09:04
    MylesBorins commented #1317
  • Jan 28 12:42
    sebamarynissen commented #1317
  • Jan 28 11:46
    codecov[bot] commented #1317
  • Jan 28 11:44
    codecov[bot] commented #1317
  • Jan 28 11:43
    sebamarynissen review_requested #1317
  • Jan 28 11:43
    sebamarynissen opened #1317
  • Jan 27 17:18
    greenkeeper[bot] commented #100
  • Jan 27 17:18

    greenkeeper[bot] on rollup-1.30.1

    chore(package): update rollup t… chore(package): update lockfile… (compare)

  • Jan 27 08:20
    greenkeeper[bot] commented #100
  • Jan 27 08:20

    greenkeeper[bot] on rollup-1.30.0

    chore(package): update rollup t… chore(package): update lockfile… (compare)

  • Jan 26 08:58
    greenkeeper[bot] commented #107
  • Jan 26 08:28
    codecov[bot] commented #1316
  • Jan 26 08:27
    codecov[bot] commented #1316
  • Jan 26 08:27
    codecov[bot] commented #1316
  • Jan 26 08:26
    codecov[bot] commented #1316
  • Jan 26 08:26
    codecov[bot] commented #1316
  • Jan 26 08:25

    greenkeeper[bot] on mocha-7.0.1

    chore(package): update mocha to… (compare)

  • Jan 26 08:23

    greenkeeper[bot] on mocha-7.0.1

    chore(package): update mocha to… chore(package): update lockfile… (compare)

  • Jan 26 08:22
    greenkeeper[bot] labeled #1316
chai-http omits undefined key/value pairs from response body any one have answers why ?
Danny Large
Anyone around?
Eric Eastwood
@LifeInLarge_twitter Better to ask your question right away instead of waiting for someone to respond. Don't ask to ask, just ask
I'm unable to achieve should.fail,
const BigNumber = web3.BigNumber;

it("should fail", function() {
  should.fail(0, 1, "Didn't failed");
got this error "TypeError: should.all is not a function"
sorry this is the correct one "Error: Invalid Chai property: fail. Did you mean "all"?:
any advice
Keith Cirkel
should.fail is not a valid test I think
you might have meant should.throw but that test looks more like you want 0.should.not.equal(1)
Tiago Correia
im trying to test a post with image upload + body fields
for some reason the body reaches empty
any idea what im missing?

Hello , I register the chai module in my wdio.conf.js file


In my test file I write:


For assert.equal I get a Warning in my IDE: require() call is missing

hi, I'm looking for advice on testing API endpoints with chai-http
I want to do some negative testing, checking that certain endpoints return 404 or 401 etc.
but they cause the request to throw an error
what's the best way to handle that?
ending up using .then and .catch and just flipping the resolve/reject
Ajmal Abdul Majeed
Hi there
im trying to use chai for my expect conditions, but thet functions done seem to be available even though i have installed the dependencies
im using appium webdriverio for my tests
any leads on how i can get chai setup successfully?
Lars Gyrup Brink Nielsen
@ajmalmajeed I use this (TypeScript):
import * as chai from 'chai';

const expect: Chai.ExpectStatic = chai.expect;

Ajmal Abdul Majeed
alright, thanks @LayZeeDK
Hi @SchnuWu_twitter , normally this happens because of the linting. For example, eslint allows for a global field in .eslintrc config file where you can define the global variables you have. You can also add there "describe" and "it".

Hi guys,

anyone knows how long does it take for Chai to detect a new plugin in npm and add it to the official list in https://www.chaijs.com/plugins/ ?

hi anyone know, when i use should, appear 'Error: Invalid Chai property: __wd_promise_enriched'
how can I use chai http to send http request? I got a curl command curl -H "Content-Type: application/json" -X POST -d '{"voiceFilePath":"https://api.voicerss.org/?key=8593c9ec738c4059963f15c139d9f41f&src=%22basf%22&hl=en-us&c=wav"}' and I expect this output: {"status":"SUCCESS","message":"Loaded","voiceFilePath":"6030039c-5626-47f9-8fde-ccb17c3d9b17.wav","recordingDuration":0,"audioData":null}

my code snippet: function callAPIHelper(endpoint, input) {
const chai = require('chai');

const serverUrl = xlVAServer[0].ServerURL;
const payload = {
voiceFilePath: input

.set('Content-Type', 'application/json')
.expect((res) => {
expect(res, body.text).toBe(payload)

but I got this error:chai.request is not a function
Larbi Jirari
hello i'd like to test an api on https, how can i add certificate ?
Error: write EPROTO 139638903605056:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1528:SSL alert number 40
Yaser Moradi
Interesting repo => Mocha + TypeScript + Chai
Hi all, i'm trying to test a node.js class that extends EventEmitter but the test returns ok even before the event is fired. Why this happen? Maybe there is a proper way to test data emitted by events.
Here is the test code, basically it have to validate a json emitted on the tick event.
const chai = require('chai')

const { expect } = chai

const RideSimulator = require('../src/RideSimulator')

describe('RideSimulator run()', () => {
    it('should return a json compliant to the schema', () => {

        let schema = { ... schema omitted ... }

        let ride = new RideSimulator(1, 1)

        ride.on('tick', (busData) => {
I found a solution here https://stackoverflow.com/questions/16826352/whats-the-best-way-to-unit-test-an-event-being-emitted-in-nodejs
Hello! I’m trying to use chainable getter AND. Not sure if this syntax is correct: expect(someCondition).to.be.true.and.expect(otherCondition).to.be.false
If not what would be the correct one using AND
Thanks in advance!!
Hi @walternolak ,
When you concatenate assertions with .and, you are still referring to the same test subject, so you can't chain another expect. Instead, do a new line and have two separate assertions beginning with expect()
Bonus points if you make it as two different tests (it block) because that's a recommended good practice for clarity: One assertion per test
@kwirke Understood! thanks for your response.
Hi how do I use chai to compare with the expected nested json such as this: const expectedJson = { "authToken": "eyJraWQiOiJVdEI4c0hhYnk0aXBLNlwvQTZnaHBkRFFqRU9tdlptSnZZQTJpNFwvM2w3UmM9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIyMTVhMGVhZS00ZjkwLTRlODItOWY4Zi1lNzhlOTdkMzcyODAiLCJldmVudF9pZCI6ImVkNGY5MDJmLTFhM2UtNDRkYy1hNjg2LWY3ZjVjZDM3ODA5OCIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE1NjUwOTk1OTAsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC51cy1lYXN0LTIuYW1hem9uYXdzLmNvbVwvdXMtZWFzdC0yX2EzbE5SRU5QMSIsImV4cCI6MTU2NTEwMzE5MCwiaWF0IjoxNTY1MDk5NTkxLCJqdGkiOiJkMjY4YjRkMi01ZWVhLTQ4OGItODUyZi1lNGM4MWRmMWFiYzMiLCJjbGllbnRfaWQiOiI2Z2xwbmRxb2s2YWhua3M2dGFnNXQ5cGMwZyIsInVzZXJuYW1lIjoicWFAdGVsZXBhdGh5LmFpIn0.UlN9bucJbjS4nT8Ly0m9zKRctkyLp9hyIVt9v2l4GdyYptOAvPC3nJl3NrVJGRICAVXRZgswWqCDfifxYUaQ64XGNCrCkLMQ9ecgsNK5ZMuFl7ebl5m1bs3FZTyD-c2fAlzRlAGlLe5ADFN-IPBDI_lmkqd3bhA9wxPrPR7uc7HOl_rjUgsqDd0saO0OPw4AmGpuSqeT56XHoc_IuPUwk6KdPEJ4kO5pIz0hw__QNspMBsoOUrH1pt4TYD9dYTMyrFGJNhPDElJBrxFpGR1TIO7eiXAc_-8z-dhEY4Ek8fyPK8ULqEyk-0UD7QgXCe6TgqdD5jBVTB3aHTYpzn2gLg", "clientInfo": { "clientId": "0d6fc71d-46ff-4441-904f-9f5fd36a43a2" } }
Isabel Giang
hello, I'm trying to test some asynchronous functions to see if they throw errors when expected
i've read that you no longer need chai-as-promised to do this
do you know what exactly I'd need to change? this is what I have right now and i'm not sure if it's correct syntactically
await expect(object.classMethod()).to.eventually.be.rejectedWith(TypeError, "errorMessage");
Dan Čermák
Is there a simple way how I can make a plugin "return a value" from an assertion chain?
for example, let's say I have this chain ctx.should.do.foo(barFuncThatReturnsSmth) and I'd like this chain to return the return value of barFuncThatReturnsSmth
I have tried to override this._obj in the definition of the method foo, but that didn't work. The object is there, but is not returned directly (it's hidden inside some __flags object)
DJ Tinkers

Anyone interested in an opensource project?

Spec oriented development speeds up programming by generating code based on tests/specs. Tests required will be the same or less specs as a normal developer writes.


MSG me if interested

Sven Murat

is it possible to pass true or false as argument, e.g.


where Enabled is true or false?

Eric Eastwood
@sven14_gitlab Yes, you can use expect(selector.isEnabled()).to.be.(true)