mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
- new Rhino .jar to help find module paths (https://github.com/hegemonic/rhino/commit/31b70105) - make __dirname and process.cwd() provide the current module path; use only env.dirname for JSDoc's home dir; fix callers - get rid of jsdoc/util/include (and update test framework accordingly) - avoid running Rhino/Node.js tests on the wrong runtime - remove support for global 'publish' function, which relied upon jsdoc/util/include - update jsdoc/util/dumper for consistency with Node.js' JSON.stringify() - fix jsdoc/util/runtime to detect Node.js correctly - add Node.js versions of jsdoc/fs and jsdoc/path - other minor cleanup
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
/*global afterEach: true, beforeEach: true, describe: true, env: true, expect: true, it: true */
|
|
describe("module names", function() {
|
|
var runtime = require('jsdoc/util/runtime');
|
|
|
|
var doclets;
|
|
|
|
var parser = require('jsdoc/src/parser');
|
|
var srcParser = null;
|
|
var sourcePaths = env.opts._.slice(0);
|
|
|
|
beforeEach(function() {
|
|
env.opts._ = [env.dirname + '/test/fixtures/modules/data/'];
|
|
srcParser = new parser.Parser();
|
|
require('jsdoc/src/handlers').attachTo(srcParser);
|
|
});
|
|
|
|
afterEach(function() {
|
|
env.opts._ = sourcePaths;
|
|
});
|
|
|
|
it("should create a name from the file path when no documented module name exists", function() {
|
|
doclets = srcParser.parse(env.dirname + '/test/fixtures/modules/data/mod-1.js');
|
|
expect(doclets.length).toBeGreaterThan(1);
|
|
expect(doclets[0].longname).toEqual('module:data/mod-1');
|
|
});
|
|
|
|
it("should use the documented module name if available", function() {
|
|
doclets = srcParser.parse(env.dirname + '/test/fixtures/modules/data/mod-2.js');
|
|
expect(doclets.length).toBeGreaterThan(1);
|
|
expect(doclets[0].longname).toEqual('module:my/module/name');
|
|
});
|
|
}); |