mithril-vndb/ospec/bin/ospec
Isiah Meadows 20f0759103
Fix docs (#2482)
* Fix #2414, address part of #1687

Also cleared the CSS up to be a lot more readable instead of smooshed
into a single line.

* Redo the testing docs page

- Addresses another part of #1687
- Also, fix a few linter issues in the ospec binary

* Add note about third-party cookies, tweak a line

* Make the JSX comparison much more meaningful

And let the code speak for itself. Don't fuel the flame wars any more
than what they've already become. We should be *unopinionated*, and so
I've updated those docs to remove the existing opinion.

* Remove a bunch of outdated ES6 references

* Remove the CSS page
2019-07-23 16:33:56 -04:00

45 lines
1.2 KiB
JavaScript
Executable file

#!/usr/bin/env node
"use strict"
var o = require("../ospec")
var path = require("path")
var glob = require("glob")
function parseArgs(argv) {
argv = ["--globs"].concat(argv.slice(2))
var args = {}
var name
argv.forEach(function(arg) {
if ((/^--/).test(arg)) {
name = arg.substr(2)
args[name] = args[name] || []
} else {
args[name].push(arg)
}
})
return args
}
var args = parseArgs(process.argv)
var globList = args.globs && args.globs.length ? args.globs : ["**/tests/**/*.js"]
var ignore = ["**/node_modules/**"].concat(args.ignore || [])
var cwd = process.cwd()
if (args.require) {
args.require.forEach(function(module) {
// eslint-disable-next-line global-require
if (module) require(require.resolve(module, {basedir: cwd}))
})
}
var pending = globList.length
globList.forEach(function(globPattern) {
glob(globPattern, {ignore: ignore})
.on("match", function(fileName) { require(path.join(cwd, fileName)) }) // eslint-disable-line global-require
.on("error", function(e) { console.error(e) })
.on("end", function() { if (--pending === 0) o.run()})
});
process.on("unhandledRejection", function(e) { console.error("Uncaught (in promise) " + e.stack) })