Skip to content

Errors subclasses instances are replaced by base Error #889

@ntrrgc

Description

@ntrrgc

Issue description or question

I run a series of test I wrote a long time ago and suddenly two of them were failing... After running several experiments I found Wallaby is changing the semantics of this:

class MyError extends Error {
    myMethod() {
        return "meow";
    }
}

console.log(new MyError() instanceof MyError);
console.log(new MyError().myMethod);

Running the previous code in a browser returns this, as expected:

true
function myMethod() {
        return "meow";
    }

But running it in Wallaby returns something not expected at all:

false
undefined

Wallaby.js configuration file

module.exports = (w) => {
    return {
        files: [
            "src/**/*.ts"
        ],
        tests: [
            "spec/**.spec.ts"
        ],
        compilers: {
            "**/*.ts": w.compilers.typeScript({module: "commonjs"}),
        },
        debug: true,
        env: {
            type: "node"
        },
        testFramework: "mocha",
        setup: function (wallaby) {
            require("bluebird").config({
                longStackTraces: true
            })
        }
    }
}

Code editor or IDE name and version

PHPStorm 2016.3

OS name and version

Arch Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions