-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding JSDocs checks * Fixed failing doc builds locally * If we test docs in the actual test script, we can skip testing docs on travis * Seperating all tests from other packages so it isn't run multiple times needlessly * Adding some logging to see why travis is unhappy * switch to log helper * Glob for nested html files too * Try a different path / glob for travis * Travis has build in it - sigh * Back to simpler tests * Correcting the gulp command for windows * Fix jsdoc test for windows on appveyor * Disable test on windows
- Loading branch information
Matt Gaunt
authored
Nov 30, 2017
1 parent
cedd1e4
commit 2445dea
Showing
5 changed files
with
81 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ install: | |
|
||
script: | ||
- gulp test | ||
- gulp docs:build | ||
|
||
after_success: | ||
- npm run coveralls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import path from 'path'; | ||
import glob from 'glob'; | ||
import {expect} from 'chai'; | ||
import fs from 'fs-extra'; | ||
import spawn from '../../../gulp-tasks/utils/spawn-promise-wrapper'; | ||
|
||
describe('[all] JSDocs', function() { | ||
it('should run JSDocs and have no unexpected results', async function() { | ||
// Windows is super unhappy with the JSDocs build pipeline. | ||
// With gulp.cmd in spawn, the query string used by the baseline template | ||
// causes issues. | ||
if (process.platform === 'win32') { | ||
this.skip(); | ||
return; | ||
} | ||
// Building docs takes time. | ||
this.timeout(60 * 1000); | ||
|
||
const projectRoot = path.join(__dirname, '..', '..', '..'); | ||
const docsPath = path.join(projectRoot, 'docs'); | ||
await spawn('gulp', ['docs:build'], { | ||
cwd: projectRoot, | ||
}); | ||
|
||
const docs = glob.sync('*.html', { | ||
cwd: docsPath, | ||
}); | ||
|
||
// global.html is only added when the docs have stray global values. | ||
if (docs.indexOf('global.html') !== -1) { | ||
throw new Error('There should be **no** globals in the JSDocs.'); | ||
} | ||
|
||
// On some occassions module.exports can leak into JSDocs and breaks | ||
// in the final template. | ||
expect(docs.indexOf('index-all.html')).to.not.equal(-1); | ||
const indexAllContents = fs.readFileSync(path.join(docsPath, 'index-all.html')) | ||
.toString(); | ||
if (indexAllContents.indexOf('<a href="module.html#.exports">module.exports</a>') !== -1) { | ||
throw new Error('There is a stray `module.exports` in the docs. ' + | ||
'Find and fix this issue.'); | ||
} | ||
}); | ||
}); |