mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
* feat(core): Switch to Promises everywhere. Adopt Node v4 ES6 Big changes: * Uses template strings where appropriate * Config and argument parsing is unified and there is no such thing as formatterOptions anymore. All user-passed options go through mergeConfig. * The node API surface changed (again): `buildSync` is removed, building operations return Promises. * Now using Flow for internal type annotations. More changes: * Remove buildSync command * feat(inference): Partially implement object shorthand support * Refs #649 * Use Flow annotations to enforce types * Keep flow but switch to comment syntax * Clarify types * More flow improvements * Turn server into class * LinkerStack becomes class too * Fix comment description type * Run flow on lint * Many more flow fixes * More intense flow refactoring * Simplify inference steps * Update inference tests, flow errors down to 1 * Continue refining types * Fix more flow issues * Use 'use strict' everywhere * Make 'ast' property configurable * Fix many tests * Fix more tests * Fix more tests * Fix augments * Test Markdown meta support * Improve test coverage * Switch back from for of to for for speed
60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
var test = require('tap').test,
|
|
path = require('path'),
|
|
shallow = require('../../../lib/input/shallow');
|
|
|
|
test('shallow deps', function (t) {
|
|
shallow([path.resolve(path.join(__dirname, '../../fixture/es6.input.js'))], {}).then(deps => {
|
|
t.equal(deps.length, 1);
|
|
t.ok(deps[0], 'has path');
|
|
t.end();
|
|
});
|
|
});
|
|
|
|
test('shallow deps multi', function (t) {
|
|
shallow([
|
|
path.resolve(path.join(__dirname, '../../fixture/es6.input.js')),
|
|
path.resolve(path.join(__dirname, '../../fixture/es6.output.json'))
|
|
], {}).then(deps => {
|
|
t.equal(deps.length, 2);
|
|
t.ok(deps[0], 'has path');
|
|
t.end();
|
|
});
|
|
});
|
|
|
|
test('shallow deps directory', function (t) {
|
|
shallow([
|
|
path.resolve(path.join(__dirname, '../../fixture/html'))
|
|
], {}).then(deps => {
|
|
t.equal(deps.length, 1);
|
|
t.ok(deps[0].file.match(/input.js/), 'is the input file');
|
|
t.end();
|
|
}).catch(err => {
|
|
t.fail(err);
|
|
t.end();
|
|
});
|
|
});
|
|
|
|
test('throws on non-string or object input', function (t) {
|
|
shallow([
|
|
true
|
|
], {}).catch(err => {
|
|
t.equal(err.message, 'Indexes should be either strings or objects');
|
|
t.end();
|
|
});
|
|
});
|
|
|
|
test('shallow deps literal', function (t) {
|
|
var obj = {
|
|
file: 'foo.js',
|
|
source: '//bar'
|
|
};
|
|
shallow([
|
|
obj
|
|
], {}).then(deps => {
|
|
t.equal(deps[0], obj);
|
|
t.end();
|
|
});
|
|
});
|