forked from jsdoc2md/jsdoc-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender-sync.js
57 lines (53 loc) · 1.63 KB
/
render-sync.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict'
const TestRunner = require('test-runner')
const jsdoc = require('../')
const Fixture = require('./lib/fixture')
const fs = require('fs')
const spawnSync = require('child_process').spawnSync
const a = require('assert')
const runner = new TestRunner()
runner.test('.renderSync({ files })', function () {
Fixture.createTmpFolder('tmp/renderSync')
const f = new Fixture('class-all')
jsdoc.renderSync({ files: f.sourcePath, destination: 'tmp/renderSync/out' })
a.doesNotThrow(function () {
fs.statSync('./tmp/renderSync/out/index.html')
})
})
runner.test('.renderSync({ source, destination })', function () {
Fixture.createTmpFolder('tmp/renderSync')
const f = new Fixture('class-all')
jsdoc.renderSync({ source: f.getSource(), destination: 'tmp/renderSync/out' })
a.doesNotThrow(function () {
fs.statSync('./tmp/renderSync/out/index.html')
})
})
runner.test('.renderSync({ source[], destination })', function () {
Fixture.createTmpFolder('tmp/renderSync')
const sources = [
`import Foo from "foo"
/**
* FooPrime is some child class
* @class
* @param {Object} - an input
* @extends Foo
*/
function FooPrime() {}
export default FooPrime
`,
`import Foo from "foo"
/**
* FooSecond is some other child class
* @class
* @param {Object} - an input
* @extends Foo
*/
function FooSecond() {}
export default FooSecond
`]
jsdoc.renderSync({ source: sources, destination: 'tmp/renderSync/out' })
a.doesNotThrow(function () {
fs.statSync('./tmp/renderSync/out/FooPrime.html')
fs.statSync('./tmp/renderSync/out/FooSecond.html')
})
})