mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
+ Use `cosmiconfig` instead of rolling our own code (which gives us YAML support)
+ Look for the config in these locations, and in this order:
+ A `jsdoc` property in `package.json`
+ `.jsdocrc` (can be JSON or YAML; comments not allowed for JSON)
+ `.jsdocrc.json` (comments allowed)
+ `.jsdocrc.yaml`
+ `.jsdocrc.yml`
+ `.jsdocrc.js`
+ `jsdoc.config.js`
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
const env = require('jsdoc/env');
|
|
const Jasmine = require('jasmine');
|
|
const klawSync = require('klaw-sync');
|
|
const path = require('path');
|
|
|
|
const SCHEMA_SPEC = path.resolve('test/specs/jsdoc/schema.js');
|
|
const SPEC_FILES = (() => {
|
|
// Normal specs are specs that don't need filtering.
|
|
const normalSpecs = [
|
|
'packages/**/test/specs/**/*.js',
|
|
'plugins/test/specs/**/*.js'
|
|
];
|
|
// Klawed specs are specs we've filtered to avoid the schema spec, which must run last.
|
|
const klawedSpecs = klawSync('test/specs', {
|
|
filter: (item) => (item.path !== SCHEMA_SPEC),
|
|
nodir: true
|
|
}).map((item) => item.path);
|
|
|
|
// We want an array of spec files with the schema spec at the end.
|
|
return normalSpecs.concat(klawedSpecs).concat([SCHEMA_SPEC]);
|
|
})();
|
|
|
|
module.exports = () => {
|
|
const jasmine = new Jasmine();
|
|
const matcher = env.opts.matcher;
|
|
/* eslint-disable no-empty-function */
|
|
const promise = new Promise(() => {});
|
|
/* eslint-enable no-empty-function */
|
|
|
|
jasmine.loadConfig({
|
|
helpers: [
|
|
'node_modules/jasmine-expect/index.js',
|
|
'test/helpers/**/*.js'
|
|
],
|
|
random: false
|
|
});
|
|
jasmine.onComplete(() => promise.resolve());
|
|
jasmine.execute(SPEC_FILES, matcher);
|
|
|
|
return promise;
|
|
};
|
|
|