esdoc-plugins
esdoc-plugins copied to clipboard
Correctly resolve class constructors integrate test plugin
When documenting my tests - if I refer to the {constructor} identifier in my it() or test() blocks it links that test to every single constructor, rather than just the constructor of identifier listed in describe()
That means that given the following:
/**
* @test {Line}
*/
describe('Line', () => {
/**
* @test {constructor}
*/
it('can be created from two points and uses them as start and end points', () => {
const start = new Point(6, 8);
const end = new Point(12, 6);
expect(() => new Line(start, end)).not.toThrow(TypeError);
});
);
that test would appear on every constructor in my project, rather than just the constructor for Line.
This can be mitigated, by putting the class name and # in front of constructor like so:
/**
* @test {Line}
*/
describe('Line', () => {
/**
* @test {Line#constructor}
*/
it('can be created from two points and uses them as start and end points', () => {
const start = new Point(6, 8);
const end = new Point(12, 6);
expect(() => new Line(start, end)).not.toThrow(TypeError);
});
);
However, it would be nice if the esdoc plugin could just figure this out