Files
react-native-devtools-frontend/node_modules/flat/cli.js
T
Peter Marshall 4e161dfc4c Update Mocha to 8.2.1
The changes can be seen here between 8.0.1 and 8.2.1:
https://github.com/mochajs/mocha/releases

There are no breaking changes.

The upgrade will give us the ability to use global fixtures which
may speed up parallel mode. I'm also hoping this fixes a bug with
describe.skip() not working properly for parallel mode.

DISABLE_THIRD_PARTY_CHECK=Update Mocha

Bug: chromium:1101784
Change-Id: Ia052a80c0f6dcefb1a2f21444cdfd3789a3203f8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2529149
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-11-10 16:16:58 +00:00

43 lines
895 B
JavaScript
Executable File

#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const readline = require('readline')
const flat = require('./index')
const filepath = process.argv.slice(2)[0]
if (filepath) {
// Read from file
const file = path.resolve(process.cwd(), filepath)
fs.accessSync(file, fs.constants.R_OK) // allow to throw if not readable
out(require(file))
} else if (process.stdin.isTTY) {
usage(0)
} else {
// Read from newline-delimited STDIN
const lines = []
readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
})
.on('line', line => lines.push(line))
.on('close', () => out(JSON.parse(lines.join('\n'))))
}
function out (data) {
process.stdout.write(JSON.stringify(flat(data), null, 2))
}
function usage (code) {
console.log(`
Usage:
flat foo.json
cat foo.json | flat
`)
process.exit(code || 0)
}