Take the following code snippet:
import { Foo } from \"./foo\";
export interface MyContext extends Mocha.Context {
foo: Foo;
}
This is i
Literally extending mocha's Context type using that derived interface is not what you want to do here. Instead, you want to augment the type defined by the library, adding your member.
This can be accomplished as follows:
// augmentations.d.ts
import {Foo} from './foo';
declare module "mocha" {
export interface Context {
foo: Foo;
}
}
Example usage:
describe("my test suite", function() {
it("should do something", function() {
console.log(this.foo);
});
});