diff --git a/src/index.mjs b/src/index.mjs index 5dbd9dc2e6..e48c4d38c4 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -57,7 +57,13 @@ export function registerGlobals() { } export function $(pieces, ...args) { - let {verbose, shell, prefix, spawn, maxBuffer = 200 * 1024 * 1024 /* 200 MiB*/} = $ + let { + verbose, + shell, + prefix, + spawn, + maxBuffer = 200 * 1024 * 1024 /* 200 MiB*/ + } = $ let __from = (new Error().stack.split(/^\s*at\s/m)[2]).trim() let cwd = process.cwd() diff --git a/test/index.test.mjs b/test/index.test.mjs index 928035d7d7..207f6085d2 100755 --- a/test/index.test.mjs +++ b/test/index.test.mjs @@ -90,7 +90,9 @@ test('Can use array as an argument', async () => { test('Quiet mode is working', async () => { let stdout = '' let log = console.log - console.log = (...args) => {stdout += args.join(' ')} + console.log = (...args) => { + stdout += args.join(' ') + } await quiet($`echo 'test'`) console.log = log assert(!stdout.includes('echo')) @@ -131,7 +133,7 @@ test('question', async () => { test('ProcessPromise', async () => { let contents = '' let stream = new Writable({ - write: function(chunk, encoding, next) { + write: function (chunk, encoding, next) { contents += chunk.toString() next() } diff --git a/test/test-utils.mjs b/test/test-utils.mjs index 2ffb78b29e..114a625801 100644 --- a/test/test-utils.mjs +++ b/test/test-utils.mjs @@ -42,7 +42,7 @@ const log = (name, group, err, file = '') => { console.log(err) console.log(file) } - console.log('\n' + chalk[ err ? 'bgRedBright' : 'bgGreenBright' ].black(`${chalk.inverse(' ' + group + ' ')} ${name} `)) + console.log('\n' + chalk[err ? 'bgRedBright' : 'bgGreenBright'].black(`${chalk.inverse(' ' + group + ' ')} ${name} `)) } export const test = async function (name, cb, ms, focus, skip) { @@ -61,7 +61,7 @@ export const test = async function (name, cb, ms, focus, skip) { passed++ log(name, group) } else { - skipped ++ + skipped++ } } catch (e) { log(name, group, e, file) @@ -76,9 +76,13 @@ export const test = async function (name, cb, ms, focus, skip) { } } -export const only = async function (name, cb, ms) { return test.call(this, name, cb, ms, true, false) } +export const only = async function (name, cb, ms) { + return test.call(this, name, cb, ms, true, false) +} -export const skip = async function (name, cb, ms) { return test.call(this, name, cb, ms, false, true) } +export const skip = async function (name, cb, ms) { + return test.call(this, name, cb, ms, false, true) +} export const testFactory = (group, meta) => Object.assign( test.bind({group, meta}), { @@ -93,8 +97,8 @@ export const printTestDigest = () => { console.log('\n' + chalk.black.bgYellowBright(` zx version is ${require('../package.json').version} `) + '\n' + chalk.greenBright(` 🍺 tests passed: ${passed} `) + - (skipped ? chalk.yellowBright (`\n 🚧 skipped: ${skipped} `) : '') + - (failed ? chalk.redBright (`\n ❌ failed: ${failed} `) : '') + (skipped ? chalk.yellowBright(`\n 🚧 skipped: ${skipped} `) : '') + + (failed ? chalk.redBright(`\n ❌ failed: ${failed} `) : '') ) failed && process.exit(1) } diff --git a/zx.mjs b/zx.mjs index 4aea9de151..1092cf5197 100755 --- a/zx.mjs +++ b/zx.mjs @@ -114,9 +114,9 @@ async function importPath(filepath, origin = filepath) { let ext = extname(filepath) if (ext === '') { - let tmpFilename = fs.existsSync(`${filepath}.mjs`) ? - `${basename(filepath)}-${Math.random().toString(36).substr(2)}.mjs` : - `${basename(filepath)}.mjs` + let tmpFilename = fs.existsSync(`${filepath}.mjs`) ? + `${basename(filepath)}-${Math.random().toString(36).substr(2)}.mjs` : + `${basename(filepath)}.mjs` return await writeAndImport( await fs.readFile(filepath),