Skip to content

Instantly share code, notes, and snippets.

@Stapleton
Created December 4, 2018 04:59
Show Gist options
  • Save Stapleton/76f5d56cba74dfa4066c5f44a6b98e93 to your computer and use it in GitHub Desktop.
Save Stapleton/76f5d56cba74dfa4066c5f44a6b98e93 to your computer and use it in GitHub Desktop.
taylor@taylor:~/Documents/Projects/tsd-jsdoc$ npm test
> tsd-jsdoc@2.0.0-beta.6 test /home/taylor/Documents/Projects/tsd-jsdoc
> mocha --ui tdd -r ts-node/register test/specs/**.ts
Class Checks
1) All
Enum Checks
✓ All (446ms)
Function Checks
✓ All (442ms)
Interface Checks
✓ All (448ms)
Namespace Checks
✓ All (492ms)
Typedef Checks
✓ All (459ms)
5 passing (3s)
1 failing
1) Class Checks
All:
AssertionError: expected '/**\n * @this OtherThing\n */\ndeclare function doStuff(): void;\n\n/**\n * @class\n * @abstract\n */\ndeclare class OtherThing {\n copy(): void;\n\n}\n\ndeclare class Stuff {\n doStuff(): void;\n\n}\n\ndeclare class Things {\n doThings(): void;\n\n}\n\n/**\n * Deep class #1\n * @class\n */\ndeclare class DeepClass1 {\n constructor();\n\n}\n\n/**\n * @module util\n */\ndeclare namespace util {\n /**\n * @class MyClass\n * @param {string} message\n * @returns {MyClass}\n */\n class MyClass {\n constructor(message: string);\n\n /**\n * @type {string}\n */\n message: string;\n\n }\n\n /**\n * GitGraph\n * @constructor\n * @param {object} options - GitGraph options\n * @param {string} [options.elementId = "gitGraph"] - Id of the canvas container\n * @param {Template|string|object} [options.template] - Template of the graph\n * @param {string} [options.author = "Sergio Flores <saxo-guy@epic.com>"] - Default author for commits\n * @param {string} [options.mode = (null|"compact")] - Display mode\n * @param {HTMLElement} [options.canvas] - DOM canvas (ex: document.getElementById("id"))\n * @param {string} [options.orientation = ("vertical-reverse"|"horizontal"|"horizontal-reverse")] - Graph orientation\n * @param {boolean} [options.reverseArrow = false] - Make arrows point to ancestors if true\n * @param {number} [options.initCommitOffsetX = 0] - Add custom offsetX to initial commit.\n * @param {number} [options.initCommitOffsetY = 0] - Add custom offsetY to initial commit.\n * @param {HTMLElement} [options.tooltipContainer = document.body] - HTML Element containing tooltips in compact mode.\n *@this GitGraph\n */\n class GitGraph {\n constructor(options: {\n elementId?: string;\n template?: any | string | object;\n author?: string;\n mode?: string;\n canvas?: HTMLElement;\n orientation?: string;\n reverseArrow?: boolean;\n initCommitOffsetX?: number;\n initCommitOffsetY?: number;\n tooltipContainer?: HTMLElement;\n });\n\n }\n\n /**\n * @class\n * @extends OtherThing\n * @mixes Stuff\n * @mixes Things\n */\n class MyThing extends OtherThing implements Stuff, Things {\n constructor(...a: number[]);\n\n /**\n * Derp or something.\n * @member {string}\n * @readonly\n */\n readonly derp: string;\n\n /**\n * @member {Object<string, Array<(number|string)>>}\n */\n map: {\n [key: string]: (number | string)[];\n };\n\n /**\n * @member {Array<Array.<Array<Array.<string[]>>>>}\n */\n superArray: ((((string[])[])[])[])[];\n\n /**\n * Creates a new thing.\n * @param {!FoobarNS.CircleOptions} opts - Namespace test!\n * @return {MyThing} the new thing.\n */\n static create(opts: any): any;\n\n /**\n * Gets a Promise that will resolve with an Object.\n * @return {Promise<Array<Object<string, number>>>} The Promise\n */\n promiseMe(): Promise<Array<{ [key: string]: number }>>;\n\n /**\n * @param {GitGraphOptions} options - GitGraph options\n */\n objParam(options: any): void;\n\n /**\n * Gets derp.\n * @member {string}\n */\n D: string;\n\n /**\n * @prop {number} Thingy\n */\n static me: number;\n\n doStuff(): void;\n\n doThings(): void;\n\n }\n\n}\n\ndeclare module \'DeepClass1\' {\n /**\n * Deep class #2\n * @class\n */\n class DeepClass2 {\n constructor();\n\n }\n\n module \'DeepClass2\' {\n /**\n * Deep class #3\n * @class\n */\n class DeepClass3 {\n constructor();\n\n }\n\n module \'DeepClass3\' {\n /**\n * Deep class #4\n * @class\n */\n class DeepClass4 {\n constructor();\n\n }\n\n }\n\n }\n\n}' to equal '/**\n * @this OtherThing\n */\ndeclare function doStuff(): void;\n\n/**\n * @class\n * @abstract\n */\ndeclare class OtherThing {\n copy(): void;\n}\n\ndeclare class Stuff {\n doStuff(): void;\n}\n\ndeclare class Things {\n doThings(): void;\n}\n\n/**\n * Deep class #1\n * @class\n */\ndeclare class DeepClass1 {\n constructor();\n}\n\n/**\n * @module util\n */\ndeclare namespace util {\n /**\n * @class MyClass\n * @param {string} message\n * @returns {MyClass}\n */\n class MyClass {\n constructor(message: string);\n\n /**\n * @type {string}\n */\n message:string;\n }\n\n /**\n * GitGraph\n * @constructor\n * @param {object} options - GitGraph options\n * @param {string} [options.elementId = "gitGraph"] - Id of the canvas container\n * @param {Template|string|object} [options.template] - Template ofthe graph\n * @param {string} [options.author = "Sergio Flores <saxo-guy@epic.com>"] - Default author for commits\n * @param {string} [options.mode = (null|"compact")] - Display mode\n * @param {HTMLElement} [options.canvas] - DOM canvas (ex: document.getElementById("id"))\n * @param {string} [options.orientation = ("vertical-reverse"|"horizontal"|"horizontal-reverse")] - Graph orientation\n * @param {boolean} [options.reverseArrow = false] - Make arrows point to ancestors if true\n * @param {number} [options.initCommitOffsetX = 0] - Add custom offsetX to initial commit.\n * @param {number} [options.initCommitOffsetY = 0] - Add custom offsetY to initial commit.\n * @param {HTMLElement} [options.tooltipContainer = document.body] - HTML Element containing tooltips in compact mode.\n * @this GitGraph\n */\n class GitGraph {\n constructor(options: {\n elementId?: string;\n template?: any | string | object;\n author?: string;\n mode?: string;\n canvas?: HTMLElement;\n orientation?: string;\n reverseArrow?: boolean;\n initCommitOffsetX?: number;\n initCommitOffsetY?: number;\n tooltipContainer?: HTMLElement;\n });\n }\n\n /**\n * @class\n * @extends OtherThing\n * @mixesStuff\n * @mixes Things\n */\n class MyThing extends OtherThing implements Stuff, Things {\n constructor(...a: number[]);\n\n /**\n * Derp or something.\n * @member {string}\n * @readonly\n */\n readonly derp:string;\n\n /**\n * @member {Object<string, Array<(number|string)>>}\n */\n map: {\n [key: string]: (number | string)[];\n };\n\n /**\n * @member {Array<Array.<Array<Array.<string[]>>>>}\n */\n superArray: ((((string[])[])[])[])[];\n\n /**\n * Creates a new thing.\n * @param {!FoobarNS.CircleOptions} opts - Namespace test!\n * @return {MyThing} the new thing.\n */\n static create(opts: any): any;\n\n /**\n * Gets a Promise that will resolve with an Object.\n * @return {Promise<Array<Object<string, number>>>} The Promise\n */\n promiseMe(): Promise<Array<{ [key: string]: string }>>;\n\n /**\n * @param {GitGraphOptions} options - GitGraphoptions\n */\n objParam(options: any): void;\n\n /**\n * Gets derp.\n * @member {string}\n*/\n D: string;\n\n /**\n * @prop {number} Thingy\n */\n static me: number;\n\n doStuff(): void;\n\n doThings(): void;\n }\n}\n\ndeclare module \'DeepClass1\' {\n /**\n * Deep class #2\n * @class\n */\n class DeepClass2 {\n constructor();\n }\n\n module \'DeepClass2\' {\n /**\n * Deep class #3\n * @class\n */\n class DeepClass3 {\n constructor();\n }\n\n module \'DeepClass3\' {\n /**\n * Deep class #4\n * @class\n */\n class DeepClass4 {\n constructor();\n }\n }\n }\n}'
+ expected - actual
* @abstract
*/
declare class OtherThing {
copy(): void;
-
}
declare class Stuff {
doStuff(): void;
-
}
declare class Things {
doThings(): void;
-
}
/**
* Deep class #1
* @class
*/
declare class DeepClass1 {
constructor();
-
}
/**
* @module util
--
/**
* @type {string}
*/
message: string;
-
}
/**
* GitGraph
--
initCommitOffsetX?: number;
initCommitOffsetY?: number;
tooltipContainer?: HTMLElement;
});
-
}
/**
* @class
--
/**
* Gets a Promise that will resolve with an Object.
* @return {Promise<Array<Object<string, number>>>} The Promise
*/
- promiseMe(): Promise<Array<{ [key: string]: number }>>;
+ promiseMe(): Promise<Array<{ [key: string]: string }>>;
/**
* @param {GitGraphOptions} options - GitGraph options
*/
--
doStuff(): void;
doThings(): void;
-
}
-
}
declare module 'DeepClass1' {
/**
--
* @class
*/
class DeepClass2 {
constructor();
-
}
module 'DeepClass2' {
/**
--
* @class
*/
class DeepClass3 {
constructor();
-
}
module 'DeepClass3' {
/**
--
* @class
*/
class DeepClass4 {
constructor();
-
}
-
}
-
}
-
}
at Object.expectJsDoc (test/lib/index.ts:42:31)
at Context.test (test/specs/class.ts:5:9)
npm ERR! Test failed. See above for more details.
taylor@taylor:~/Documents/Projects/tsd-jsdoc$
taylor@taylor:~/Documents/Projects/tsd-jsdoc$ npm test
> tsd-jsdoc@2.0.0-beta.6 test /home/taylor/Documents/Projects/tsd-jsdoc
> mocha --ui tdd -r ts-node/register test/specs/**.ts
Class Checks
1) All
Enum Checks
✓ All (457ms)
Function Checks
✓ All (450ms)
Interface Checks
✓ All (442ms)
Namespace Checks
✓ All (467ms)
Typedef Checks
✓ All (451ms)
5 passing (3s)
1 failing
1) Class Checks
All:
AssertionError: expected '/**\n * @this OtherThing\n */\ndeclare function doStuff(): void;\n\n/**\n * @class\n * @abstract\n */\ndeclare class OtherThing {\n copy(): void;\n\n}\n\ndeclare class Stuff {\n doStuff(): void;\n\n}\n\ndeclare class Things {\n doThings(): void;\n\n}\n\n/**\n * Deep class #1\n * @class\n */\ndeclare class DeepClass1 {\n constructor();\n\n}\n\n/**\n * @module util\n */\ndeclare namespace util {\n /**\n * @class MyClass\n * @param {string} message\n * @returns {MyClass}\n */\n class MyClass {\n constructor(message: string);\n\n /**\n * @type {string}\n */\n message: string;\n\n }\n\n /**\n * GitGraph\n * @constructor\n * @param {object} options - GitGraph options\n * @param {string} [options.elementId = "gitGraph"] - Id of the canvas container\n * @param {Template|string|object} [options.template] - Template of the graph\n * @param {string} [options.author = "Sergio Flores <saxo-guy@epic.com>"] - Default author for commits\n * @param {string} [options.mode = (null|"compact")] - Display mode\n * @param {HTMLElement} [options.canvas] - DOM canvas (ex: document.getElementById("id"))\n * @param {string} [options.orientation = ("vertical-reverse"|"horizontal"|"horizontal-reverse")] - Graph orientation\n * @param {boolean} [options.reverseArrow = false] - Make arrows point to ancestors if true\n * @param {number} [options.initCommitOffsetX = 0] - Add custom offsetX to initial commit.\n * @param {number} [options.initCommitOffsetY = 0] - Add custom offsetY to initial commit.\n * @param {HTMLElement} [options.tooltipContainer = document.body] - HTML Element containing tooltips in compact mode.\n *@this GitGraph\n */\n class GitGraph {\n constructor(options: {\n elementId?: string;\n template?: any | string | object;\n author?: string;\n mode?: string;\n canvas?: HTMLElement;\n orientation?: string;\n reverseArrow?: boolean;\n initCommitOffsetX?: number;\n initCommitOffsetY?: number;\n tooltipContainer?: HTMLElement;\n });\n\n }\n\n /**\n * @class\n * @extends OtherThing\n * @mixes Stuff\n * @mixes Things\n */\n class MyThing extends OtherThing implements Stuff, Things {\n constructor(...a: number[]);\n\n /**\n * Derp or something.\n * @member {string}\n * @readonly\n */\n readonly derp: string;\n\n /**\n * @member {Object<string, Array<(number|string)>>}\n */\n map: {\n [key: string]: (number | string)[];\n };\n\n /**\n * @member {Array<Array.<Array<Array.<string[]>>>>}\n */\n superArray: ((((string[])[])[])[])[];\n\n /**\n * Creates a new thing.\n * @param {!FoobarNS.CircleOptions} opts - Namespace test!\n * @return {MyThing} the new thing.\n */\n static create(opts: any): any;\n\n /**\n * Gets a Promise that will resolve with an Object.\n * @return {Promise<Array<Object<string, number>>>} The Promise\n */\n promiseMe(): Promise<Array<{ [key: string]: number }>>;\n\n /**\n * @param {GitGraphOptions} options - GitGraph options\n */\n objParam(options: any): void;\n\n /**\n * Gets derp.\n * @member {string}\n */\n D: string;\n\n /**\n * @prop {number} Thingy\n */\n static me: number;\n\n doStuff(): void;\n\n doThings(): void;\n\n }\n\n}\n\ndeclare module \'DeepClass1\' {\n /**\n * Deep class #2\n * @class\n */\n class DeepClass2 {\n constructor();\n\n }\n\n module \'DeepClass2\' {\n /**\n * Deep class #3\n * @class\n */\n class DeepClass3 {\n constructor();\n\n }\n\n module \'DeepClass3\' {\n /**\n * Deep class #4\n * @class\n */\n class DeepClass4 {\n constructor();\n\n }\n\n }\n\n }\n\n}' to equal '/**\n * @this OtherThing\n */\ndeclare function doStuff(): void;\n\n/**\n * @class\n * @abstract\n */\ndeclare class OtherThing {\n copy(): void;\n}\n\ndeclare class Stuff {\n doStuff(): void;\n}\n\ndeclare class Things {\n doThings(): void;\n}\n\n/**\n * Deep class #1\n * @class\n */\ndeclare class DeepClass1 {\n constructor();\n}\n\n/**\n * @module util\n */\ndeclare namespace util {\n /**\n * @class MyClass\n * @param {string} message\n * @returns {MyClass}\n */\n class MyClass {\n constructor(message: string);\n\n /**\n * @type {string}\n */\n message:string;\n }\n\n /**\n * GitGraph\n * @constructor\n * @param {object} options - GitGraph options\n * @param {string} [options.elementId = "gitGraph"] - Id of the canvas container\n * @param {Template|string|object} [options.template] - Template ofthe graph\n * @param {string} [options.author = "Sergio Flores <saxo-guy@epic.com>"] - Default author for commits\n * @param {string} [options.mode = (null|"compact")] - Display mode\n * @param {HTMLElement} [options.canvas] - DOM canvas (ex: document.getElementById("id"))\n * @param {string} [options.orientation = ("vertical-reverse"|"horizontal"|"horizontal-reverse")] - Graph orientation\n * @param {boolean} [options.reverseArrow = false] - Make arrows point to ancestors if true\n * @param {number} [options.initCommitOffsetX = 0] - Add custom offsetX to initial commit.\n * @param {number} [options.initCommitOffsetY = 0] - Add custom offsetY to initial commit.\n * @param {HTMLElement} [options.tooltipContainer = document.body] - HTML Element containing tooltips in compact mode.\n * @this GitGraph\n */\n class GitGraph {\n constructor(options: {\n elementId?: string;\n template?: any | string | object;\n author?: string;\n mode?: string;\n canvas?: HTMLElement;\n orientation?: string;\n reverseArrow?: boolean;\n initCommitOffsetX?: number;\n initCommitOffsetY?: number;\n tooltipContainer?: HTMLElement;\n });\n }\n\n /**\n * @class\n * @extends OtherThing\n * @mixesStuff\n * @mixes Things\n */\n class MyThing extends OtherThing implements Stuff, Things {\n constructor(...a: number[]);\n\n /**\n * Derp or something.\n * @member {string}\n * @readonly\n */\n readonly derp:string;\n\n /**\n * @member {Object<string, Array<(number|string)>>}\n */\n map: {\n [key: string]: (number | string)[];\n };\n\n /**\n * @member {Array<Array.<Array<Array.<string[]>>>>}\n */\n superArray: ((((string[])[])[])[])[];\n\n /**\n * Creates a new thing.\n * @param {!FoobarNS.CircleOptions} opts - Namespace test!\n * @return {MyThing} the new thing.\n */\n static create(opts: any): any;\n\n /**\n * Gets a Promise that will resolve with an Object.\n * @return {Promise<Array<Object<string, number>>>} The Promise\n */\n promiseMe(): Promise<Array<{ [key: string]: number }>>;\n\n /**\n * @param {GitGraphOptions} options - GitGraphoptions\n */\n objParam(options: any): void;\n\n /**\n * Gets derp.\n * @member {string}\n*/\n D: string;\n\n /**\n * @prop {number} Thingy\n */\n static me: number;\n\n doStuff(): void;\n\n doThings(): void;\n }\n}\n\ndeclare module \'DeepClass1\' {\n /**\n * Deep class #2\n * @class\n */\n class DeepClass2 {\n constructor();\n }\n\n module \'DeepClass2\' {\n /**\n * Deep class #3\n * @class\n */\n class DeepClass3 {\n constructor();\n }\n\n module \'DeepClass3\' {\n /**\n * Deep class #4\n * @class\n */\n class DeepClass4 {\n constructor();\n }\n }\n }\n}'
+ expected - actual
* @abstract
*/
declare class OtherThing {
copy(): void;
-
}
declare class Stuff {
doStuff(): void;
-
}
declare class Things {
doThings(): void;
-
}
/**
* Deep class #1
* @class
*/
declare class DeepClass1 {
constructor();
-
}
/**
* @module util
--
/**
* @type {string}
*/
message: string;
-
}
/**
* GitGraph
--
initCommitOffsetX?: number;
initCommitOffsetY?: number;
tooltipContainer?: HTMLElement;
});
-
}
/**
* @class
--
doStuff(): void;
doThings(): void;
-
}
-
}
declare module 'DeepClass1' {
/**
--
* @class
*/
class DeepClass2 {
constructor();
-
}
module 'DeepClass2' {
/**
--
* @class
*/
class DeepClass3 {
constructor();
-
}
module 'DeepClass3' {
/**
--
* @class
*/
class DeepClass4 {
constructor();
-
}
-
}
-
}
-
}
at Object.expectJsDoc (test/lib/index.ts:42:31)
at Context.test (test/specs/class.ts:5:9)
npm ERR! Test failed. See above for more details.
taylor@taylor:~/Documents/Projects/tsd-jsdoc$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment