alsatian
alsatian copied to clipboard
Not checking whether exported members are constructors
As noted in #197 looks like there is also a case that a function can be exported in a fixture file and we attempt to construct this. Need to do an additional test to check whether it's newable or try catch.
Below is the offending code in test-loader.ts
if (typeof testFixtureModule === "function") {
// if the default export is class constructor
loadFixture(testFixtureModule, testFixtureModule.name);
} else {
// otherwise there are multiple exports and we must handle all of them
Object.keys(testFixtureModule)
.filter(key => typeof testFixtureModule[key] === "function")
.forEach(key => loadFixture(testFixtureModule[key], key));
}