From 76b3135123c03d5bd17e671496bdd356bae6016e Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Mon, 22 Aug 2016 14:35:18 -0700 Subject: [PATCH] Rebase and use options pragma in test file --- test/bin.js | 6 +- test/fixture/document-exported.input.js | 2 + .../document-exported.output.enabled.json | 602 ------------------ .../document-exported.output.enabled.md | 37 -- test/fixture/document-exported.output.json | 590 ++++++++++++++++- test/fixture/document-exported.output.md | 38 ++ test/fixture/document-exported.output.md.json | 248 +++++++- test/test.js | 19 - 8 files changed, 879 insertions(+), 663 deletions(-) delete mode 100644 test/fixture/document-exported.output.enabled.json delete mode 100644 test/fixture/document-exported.output.enabled.md diff --git a/test/bin.js b/test/bin.js index f243b95e3..a6934a8c0 100644 --- a/test/bin.js +++ b/test/bin.js @@ -340,14 +340,14 @@ test('fatal error', options, function (t) { t.ok(err.toString().match(/Unexpected token/), 'reports syntax error'); t.end(); }, false); -}, options); +}); test('build --document-exported', function (t) { documentation(['build fixture/document-exported.input.js --document-exported -f md'], {}, function (err, data) { t.error(err); - var outputfile = path.join(__dirname, 'fixture', 'document-exported.output.enabled.md'); + var outputfile = path.join(__dirname, 'fixture', 'document-exported.output.md'); if (process.env.UPDATE) { fs.writeFileSync(outputfile, data, 'utf8'); } @@ -356,4 +356,4 @@ test('build --document-exported', function (t) { t.equal(data, expect); t.end(); }, false); -}); +}, options); diff --git a/test/fixture/document-exported.input.js b/test/fixture/document-exported.input.js index 905529424..67cf1db5a 100644 --- a/test/fixture/document-exported.input.js +++ b/test/fixture/document-exported.input.js @@ -1,3 +1,5 @@ +// Options: {"documentExported": true} + export class Class { classMethod() {} get classGetter() {} diff --git a/test/fixture/document-exported.output.enabled.json b/test/fixture/document-exported.output.enabled.json deleted file mode 100644 index 49a296a6d..000000000 --- a/test/fixture/document-exported.output.enabled.json +++ /dev/null @@ -1,602 +0,0 @@ -[ - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 8, - "column": 1 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 8, - "column": 1 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "Class", - "members": { - "instance": [ - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "context": { - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "classMethod", - "kind": "function", - "memberof": "Class", - "scope": "instance", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "Class" - }, - { - "name": "classMethod", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "Class#classMethod" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 22 - } - }, - "context": { - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 22 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "classGetter", - "kind": "member", - "memberof": "Class", - "scope": "instance", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "Class" - }, - { - "name": "classGetter", - "kind": "member", - "scope": "instance" - } - ], - "namespace": "Class#classGetter" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "context": { - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "classSetter", - "kind": "member", - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 4 - } - ], - "memberof": "Class", - "scope": "instance", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "Class" - }, - { - "name": "classSetter", - "kind": "member", - "scope": "instance" - } - ], - "namespace": "Class#classSetter" - } - ], - "static": [ - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 26 - } - }, - "context": { - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 26 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "staticMethod", - "kind": "function", - "memberof": "Class", - "scope": "static", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "Class" - }, - { - "name": "staticMethod", - "kind": "function", - "scope": "static" - } - ], - "namespace": "Class.staticMethod" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 30 - } - }, - "context": { - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 30 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "staticGetter", - "kind": "member", - "memberof": "Class", - "scope": "static", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "Class" - }, - { - "name": "staticGetter", - "kind": "member", - "scope": "static" - } - ], - "namespace": "Class.staticGetter" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 31 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 31 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "staticSetter", - "kind": "member", - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 7 - } - ], - "memberof": "Class", - "scope": "static", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "Class" - }, - { - "name": "staticSetter", - "kind": "member", - "scope": "static" - } - ], - "namespace": "Class.staticSetter" - } - ], - "events": [] - }, - "path": [ - { - "name": "Class" - } - ], - "namespace": "Class" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 16, - "column": 2 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 16, - "column": 2 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "object", - "members": { - "instance": [], - "static": [ - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 10 - } - }, - "context": { - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 10 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "prop", - "memberof": "object", - "scope": "static", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "object" - }, - { - "name": "prop", - "scope": "static" - } - ], - "namespace": "object.prop" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 21 - } - }, - "context": { - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 21 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "func", - "kind": "function", - "memberof": "object", - "scope": "static", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "object" - }, - { - "name": "func", - "kind": "function", - "scope": "static" - } - ], - "namespace": "object.func" - } - ] - }, - "path": [ - { - "name": "object" - } - ], - "namespace": "object" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 13 - } - }, - "context": { - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 13 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "method", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "method", - "kind": "function" - } - ], - "namespace": "method" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 17 - } - }, - "context": { - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 17 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "getter", - "kind": "member", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "getter", - "kind": "member" - } - ], - "namespace": "getter" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 18 - } - }, - "context": { - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 18 - } - }, - "code": "export class Class {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nexport var object = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n\nclass NotExportedClass {\n classMethod() {}\n get classGetter() {}\n set classSetter(v) {}\n static staticMethod() {}\n static get staticGetter() {}\n static set staticSetter(v) {}\n}\n\nvar notExportedObject = {\n method() {},\n get getter() {},\n set setter(v) {},\n prop: 42,\n func: function() {},\n};\n" - }, - "errors": [], - "name": "setter", - "kind": "member", - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 13 - } - ], - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "setter", - "kind": "member" - } - ], - "namespace": "setter" - } -] \ No newline at end of file diff --git a/test/fixture/document-exported.output.enabled.md b/test/fixture/document-exported.output.enabled.md deleted file mode 100644 index ec6b83e9d..000000000 --- a/test/fixture/document-exported.output.enabled.md +++ /dev/null @@ -1,37 +0,0 @@ -# Class - -## classMethod - -## classGetter - -## classSetter - -**Parameters** - -- `v` - -## staticMethod - -## staticGetter - -## staticSetter - -**Parameters** - -- `v` - -# object - -## prop - -## func - -# method - -# getter - -# setter - -**Parameters** - -- `v` diff --git a/test/fixture/document-exported.output.json b/test/fixture/document-exported.output.json index 0637a088a..dafd32387 100644 --- a/test/fixture/document-exported.output.json +++ b/test/fixture/document-exported.output.json @@ -1 +1,589 @@ -[] \ No newline at end of file +[ + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "context": { + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + "errors": [], + "name": "Class", + "members": { + "instance": [ + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "context": { + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "errors": [], + "name": "classMethod", + "kind": "function", + "memberof": "Class", + "scope": "instance", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Class" + }, + { + "name": "classMethod", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "Class#classMethod" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 22 + } + }, + "context": { + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "errors": [], + "name": "classGetter", + "kind": "member", + "memberof": "Class", + "scope": "instance", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Class" + }, + { + "name": "classGetter", + "kind": "member", + "scope": "instance" + } + ], + "namespace": "Class#classGetter" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 23 + } + }, + "context": { + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "errors": [], + "name": "classSetter", + "kind": "member", + "params": [ + { + "title": "param", + "name": "v", + "lineNumber": 6 + } + ], + "memberof": "Class", + "scope": "instance", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Class" + }, + { + "name": "classSetter", + "kind": "member", + "scope": "instance" + } + ], + "namespace": "Class#classSetter" + } + ], + "static": [ + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 26 + } + }, + "context": { + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "errors": [], + "name": "staticMethod", + "kind": "function", + "memberof": "Class", + "scope": "static", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Class" + }, + { + "name": "staticMethod", + "kind": "function", + "scope": "static" + } + ], + "namespace": "Class.staticMethod" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 30 + } + }, + "context": { + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + "errors": [], + "name": "staticGetter", + "kind": "member", + "memberof": "Class", + "scope": "static", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Class" + }, + { + "name": "staticGetter", + "kind": "member", + "scope": "static" + } + ], + "namespace": "Class.staticGetter" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 31 + } + }, + "context": { + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 31 + } + } + }, + "errors": [], + "name": "staticSetter", + "kind": "member", + "params": [ + { + "title": "param", + "name": "v", + "lineNumber": 9 + } + ], + "memberof": "Class", + "scope": "static", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Class" + }, + { + "name": "staticSetter", + "kind": "member", + "scope": "static" + } + ], + "namespace": "Class.staticSetter" + } + ], + "events": [] + }, + "path": [ + { + "name": "Class" + } + ], + "namespace": "Class" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 18, + "column": 2 + } + }, + "context": { + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "errors": [], + "name": "object", + "members": { + "instance": [], + "static": [ + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "context": { + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + "errors": [], + "name": "prop", + "memberof": "object", + "scope": "static", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "object" + }, + { + "name": "prop", + "scope": "static" + } + ], + "namespace": "object.prop" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 21 + } + }, + "context": { + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 21 + } + } + }, + "errors": [], + "name": "func", + "kind": "function", + "memberof": "object", + "scope": "static", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "object" + }, + { + "name": "func", + "kind": "function", + "scope": "static" + } + ], + "namespace": "object.func" + } + ] + }, + "path": [ + { + "name": "object" + } + ], + "namespace": "object" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 13 + } + }, + "context": { + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "errors": [], + "name": "method", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "method", + "kind": "function" + } + ], + "namespace": "method" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 17 + } + }, + "context": { + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + "errors": [], + "name": "getter", + "kind": "member", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "getter", + "kind": "member" + } + ], + "namespace": "getter" + }, + { + "description": "", + "tags": [], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 18 + } + }, + "context": { + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "errors": [], + "name": "setter", + "kind": "member", + "params": [ + { + "title": "param", + "name": "v", + "lineNumber": 15 + } + ], + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "setter", + "kind": "member" + } + ], + "namespace": "setter" + } +] \ No newline at end of file diff --git a/test/fixture/document-exported.output.md b/test/fixture/document-exported.output.md index 8b1378917..a515467d0 100644 --- a/test/fixture/document-exported.output.md +++ b/test/fixture/document-exported.output.md @@ -1 +1,39 @@ + +# Class + +## classMethod + +## classGetter + +## classSetter + +**Parameters** + +- `v` + +## staticMethod + +## staticGetter + +## staticSetter + +**Parameters** + +- `v` + +# object + +## prop + +## func + +# method + +# getter + +# setter + +**Parameters** + +- `v` diff --git a/test/fixture/document-exported.output.md.json b/test/fixture/document-exported.output.md.json index 2b1e4c832..77eaa00f0 100644 --- a/test/fixture/document-exported.output.md.json +++ b/test/fixture/document-exported.output.md.json @@ -1,4 +1,250 @@ { "type": "root", - "children": [] + "children": [ + { + "type": "html", + "value": "" + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "Class" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "classMethod" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "classGetter" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "classSetter" + } + ] + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "v" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "staticMethod" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "staticGetter" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "staticSetter" + } + ] + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "v" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "object" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "prop" + } + ] + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "func" + } + ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "method" + } + ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "getter" + } + ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "setter" + } + ] + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "v" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + } + ] } \ No newline at end of file diff --git a/test/test.js b/test/test.js index 2760ca28b..91e561d0b 100644 --- a/test/test.js +++ b/test/test.js @@ -295,22 +295,3 @@ test('.lint with bad input', function (t) { }); }); }); - -test('document exported', function (t) { - documentation.build([ - path.join(__dirname, 'fixture', 'document-exported.input.js') - ], { - documentExported: true - }, function (err, result) { - t.ifError(err); - normalize(result); - var outputfile = path.join(__dirname, 'fixture', 'document-exported.output.enabled.json'); - var resultString = JSON.stringify(result, null ,2); - if (UPDATE) { - fs.writeFileSync(outputfile, resultString); - } - var expect = fs.readFileSync(outputfile, 'utf-8'); - t.equal(resultString, expect); - t.end(); - }); -});