Cleanup markdown-doctest-setup.

This commit is contained in:
John-David Dalton
2016-04-29 11:57:41 -07:00
parent ef1024bb60
commit c3c6bc9666
3 changed files with 35 additions and 44 deletions

View File

@@ -1,53 +1,44 @@
var _ = require(__dirname);
var _ = require('./lodash.js');
function jQuery () {
function mockQuery() {
return {
on: function (ev, cb) {
cb()
'on': function(eventName, callback) {
callback();
}
}
};
}
jQuery.each = function (items, f) {
items.forEach(f)
}
mockQuery.each = _.each;
module.exports = {
globals: {
'babel': false,
'globals': {
'_': _,
asyncSave: _.noop,
addContactToList: _.noop,
calculateLayout: _.noop,
createApplication: _.noop,
updatePosition: _.noop,
sendMail: _.noop,
renewToken: _.noop,
batchLog: _.noop,
// Example mocks.
'asyncSave': _.noop,
'addContactToList': _.noop,
'batchLog': _.noop,
'calculateLayout': _.noop,
'createApplication': _.noop,
'data': { 'user': 'mock'},
'mainText': '',
'renewToken': _.noop,
'sendMail': _.noop,
'updatePosition': _.noop,
setImmediate: setImmediate,
Buffer: Buffer,
EventSource: function () {},
// DOM mocks.
'document': { 'body': { 'childNodes': [], 'nodeName': 'BODY' } },
'element': {},
'EventSource': _.noop,
'jQuery': mockQuery,
'window': {},
fs: {writeFileSync: _.noop},
path: {join: _.noop},
cwd: __dirname,
mainText: '',
data: {user: 'mock'},
document: {
body: {
childNodes: [],
nodeName: 'body'
}
},
jQuery: jQuery,
element: {},
window: {}
},
babel: false
// Node.js mocks.
'Buffer': Buffer,
'fs': { 'writeFileSync': _.noop },
'path': require('path'),
'process': process,
'setImmediate': setImmediate
}
}

View File

@@ -13941,7 +13941,7 @@
*
* // Use the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and stack traces.
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\
* fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
* var JST = {\
* "main": ' + _.template(mainText).source + '\
* };\

View File

@@ -10,7 +10,7 @@
"build:fp-modules": "node lib/fp/build-modules.js",
"build:main": "node lib/main/build-dist.js",
"build:main-modules": "node lib/main/build-modules.js",
"doc": "node lib/main/build-doc github && npm run test:docs",
"doc": "node lib/main/build-doc github && npm run test:doc",
"doc:fp": "node lib/fp/build-doc",
"doc:site": "node lib/main/build-doc site",
"pretest": "npm run build",
@@ -20,9 +20,9 @@
"style:perf": "jscs perf/*.js perf/**/*.js",
"style:test": "jscs test/*.js test/**/*.js",
"test": "npm run test:main && npm run test:fp",
"test:doc": "markdown-doctest",
"test:fp": "node test/test-fp",
"test:main": "node test/test",
"test:docs": "markdown-doctest",
"validate": "npm run style && npm run test"
},
"devDependencies": {