Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codecoverage fails: Cannot read property 'push' of undefined #547

Closed
lcorneliussen opened this issue Apr 5, 2016 · 9 comments
Closed

Codecoverage fails: Cannot read property 'push' of undefined #547

lcorneliussen opened this issue Apr 5, 2016 · 9 comments
Labels

Comments

@lcorneliussen
Copy link

Issue description or question

I ran a working test set with a new version of wallaby. Still trying to find out, which test exactly causes the problem.

Wallaby.js configuration file

Tue, 05 Apr 2016 10:38:13 GMT wallaby:project Failed to process test run results TypeError: Cannot read property 'push' of undefined
  at C:\Users\Lars Corneliussen\.wallaby\core\server.js:16:28950
  at arrayEach (C:\Users\Lars Corneliussen\.wallaby\core\node_modules\lodash\index.js:1286:13)Failed to process test run results Cannot read property 'push' of undefined

  at Function.forEach (C:\Users\Lars Corneliussen\.wallaby\core\node_modules\lodash\index.js:5700:11)
  at EventEmitter._.extend._processCoverageResult (C:\Users\Lars Corneliussen\.wallaby\core\server.js:16:28130)
  at C:\Users\Lars Corneliussen\.wallaby\core\server.js:16:22010
  at _fulfilled (C:\Users\Lars Corneliussen\.wallaby\core\node_modules\q\q.js:787:54)
  at self.promiseDispatch.done (C:\Users\Lars Corneliussen\.wallaby\core\node_modules\q\q.js:816:30)
  at Promise.promise.promiseDispatch (C:\Users\Lars Corneliussen\.wallaby\core\node_modules\q\q.js:749:13)
  at C:\Users\Lars Corneliussen\.wallaby\core\node_modules\q\q.js:557:44
  at flush (C:\Users\Lars Corneliussen\.wallaby\core\node_modules\q\q.js:108:17)

Code editor or IDE name and version

Visual Studio 2015 Update 1

OS name and version

Windows 10

@lcorneliussen
Copy link
Author

Looks like this test is causing the problem. Will look at the details later:

describe("two different dates are set to same when updating aggregate", function (done) {

        var date = new Date();
        var d1 = ko.observable(date);
        var d2 = ko.observable(new Date(date + 1));

        beforeEach(function(done) {
            var dates = ko.observable([
                ko.computed({ read: d1, write: d2 }),
                ko.computed({
                    read: d2,
                    write: function(value) {
                        console.log(value);
                        d2(value);
                    }
                })
            ]);
            var aggr = ko.aggregate(dates);
            aggr(new Date(date));

            _.delay(done, 500);
        });

        it("should be", function() {
            expect(d1().getTime()).toBe(date.getTime());
            expect(d2().getTime()).toBe(date.getTime());
        });

    });

@ArtemGovorov
Copy link
Member

Perhaps it's a caching issue, try changing wallaby.js config file (even a space anywhere will do), restart wallaby and see if the issue goes away.

I'm trying to create the sample to run your tests locally, but can't run it yet.
It's been a long time since I have used knockout, what is ko.aggregate? It says 'undefined' is not a function (evaluating 'ko.aggregate...? I'm using knockout 3.4.0.

One (most likely unrelated) thing I have noticed is that you are passing done as an argument the describe function body and jasmine doesn't support it (you're not using it anyway).

@ArtemGovorov
Copy link
Member

I have also reviewed few latest versions of wallaby and didn't find any changes that might affect this scenario, are you sure the test suite was running fine earlier? Perhaps you have changed something else in your project recently?

@lcorneliussen
Copy link
Author

Hi. Back now.

Found out about it: A colleague added a new test which also passed when he added it - but restarting wallaby afterwords failed. That happens if a it and a describe have the same name.

Running incrementally it is no problem, but when loading initially it fails with the error I gave you:

describe("desc", function() {
    it("duplicate", function() {

    });
    describe("duplicate", function() {
        it("test", function () {

        });
    });
});

@lcorneliussen
Copy link
Author

I don't know what the spec says, but tryjasmine.com doesn't bother complaining

@ArtemGovorov
Copy link
Member

That happens if a it and a describe have the same name.

Great catch! Thanks a lot for isolating it.
The issue is fixed in the latest core v1.0.212. Will be updated automatically within the next 20 minutes after the next wallaby restart. To force the update to happen now, just restart your IDE and start wallaby.js.

@lcorneliussen
Copy link
Author

np. i fixed the names :)

@lcorneliussen
Copy link
Author

but thx for fixing that fast. and thanks for the great product.
wallaby has dramatically changed my approach to javascript testing

actually, I'm now writing tests :)

@ArtemGovorov
Copy link
Member

@lcorneliussen Hehe, thanks! Glad to hear it makes testing easier for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants