mmanela / chutzpah

Chutzpah is an open source JavaScript test runner which enables you to run unit tests using QUnit, Jasmine, Mocha and TypeScript.
http://mmanela.github.io/chutzpah/
Apache License 2.0
550 stars 142 forks source link

Chutzpah test explorer in VS 2017 cant find variable Promise #749

Closed fahad-nadeem closed 5 years ago

fahad-nadeem commented 5 years ago

Hi,

My tests are running fine in the browser but inside the test explorer or the console I get the error

ReferenceError: Can't find variable: Promise

My code is as follows:

`/// /// ///

describe("Test Retrieve Call Accept", function () {

afterEach(function () {
    Xrm.WebApi.RetrieveRecord = sinon.restore();
});

it("Should call succcess callback", function(done){
    var successCallback;
    var errorCallback;
    successCallback = sinon.spy();
    errorCallback = sinon.spy();

    Xrm.WebApi.RetrieveRecord = sinon.stub().callsFake(function () {
        return sinon.stub().resolves("DATA")().then(function (value) {
            successCallback();
            expect(successCallback.calledOnce).toBe(true);
        });
    });
    CRUD.RetrieveRecord("test", "test", "test", successCallback, errorCallback);
    done();
});

});`

mmanela commented 5 years ago

Which browser engine for Chutzpah are you using?

fahad-nadeem commented 5 years ago

I am running the harness file in Google Chrome and it works. Using Chutzpah.Console fails.

mmanela commented 5 years ago

You can try running chutzpah using chrome or jsom to see if it helps https://github.com/mmanela/chutzpah/wiki/Browser-Engines

fahad-nadeem commented 5 years ago

Thanks a lot Matthew! That did it.