Why do I continue to receive this TypeError: expect is not a function

728 Views Asked by At

I'm using chai 4.2.0 and is not working as expected, this is the example.

Receiving this TypeError: expect is not a function and wondering why if I'm using a global variable.

var chai = require('chai');
var expect = chai.expect;

describe("Homepage FAQ Accordion", function () {
    beforeEach(function() {

        console.log(expect.expect);
        browser.url('http://127.0.0.1:8303/');
   })

it("should show first section on page load", function() {

var firstHeight = browser.getCssProperty(".accordion .accordion-item:first-child .accordion-content", "height");

        var firstHeight = browser.getTitle();

        console.log(firstHeight);

        expect(firstHeight.parsed.value).to.be.greaterThan(0);
    })
it("should not show other content", function() {
        var secondHeight = browser.getCssProperty(".accordion .accordion-item:nth-of-type(2) .accordion-content", "Display")

        console.log(secondDisplay);

        expect(secondDisplay.parsed.value).to.equal(none);

    })
})

0

There are 0 best solutions below