// Run everything in parallel... async.parallel(data.map((file) => { return (callback) => { pack.entry({name: file.filename}, file.buffer, () => { packSize += file.buffer.byteLength; progress.log(`Packing "${file.filename}" (${((packSize / data._size) * 100).toFixed(2)}%) ...`); callback(); }); }; }), (err) => { if (err) { return reject(err); } pack.finalize(); });
test('clinic flame --name', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'flame', '--no-open', '--name', 'custom-name', '--', 'node', '-e', 'setTimeout(() => {}, 300)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const htmlFilename = stdout.match(/(\d+\.custom-name)/)[1] const dirname = path.dirname(htmlFilename) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, htmlFilename), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic bubbleprof -- node - bad status code', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'bubbleprof', '--no-open', '--', 'node', '-e', 'process.exit(1)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-bubbleprof)/)[1] const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname))) t.strictEqual(stdout.split('\n')[1], 'Analysing data') t.strictEqual(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, dirname + '.html'), done) } }, function (err) { t.ifError(err) t.end() }) }) })
async.parallel({ createBigFile (done) { const bigFilepath = path.resolve(bigFileDirectory, 'big-file.tmp')
async.parallel({ stderr (done) { collect(program.stderr, function (err, chunks) {
async.parallel({ createEmptyDirectory (done) { fs.mkdir(path.dirname(emptyDataDirectory), function (err) {
async.parallel([ getTokens.bind(null, resource), getFunctionDetails.bind(null, resource, service, functionName, identifier)
test('clinic flame --output-html', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'flame', '--no-open', '--output-html', '{name}-{pid}-{timestamp}.html', '--', 'node', '-e', 'setTimeout(() => {}, 300)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const match = stderr.match(/\/(clinic-flame-)(\d+)(-)(\d+)(\.html)/) const htmlFilename = match.slice(1).join('') const pid = match[2] const dirname = path.join(path.dirname(htmlFilename), pid + '.clinic-flame') // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, htmlFilename), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic doctor -- node - bad status code', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'doctor', '--no-open', '--', 'node', '-e', 'setTimeout(() => { process.exit(1) }, 400)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-doctor)/)[1] const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname))) t.strictEqual(stdout.split('\n')[1], 'Analysing data') t.strictEqual(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, dirname + '.html'), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic flame --output-dir', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'flame', '--no-open', '--output-dir', '{name}-{pid}', '--', 'node', '-e', 'setTimeout(() => {}, 300)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const match = stderr.match(/\/(\d+)(\.)(clinic-flame)(\.html)/) const htmlFilename = match.slice(1).join('') const pid = match[1] const dirname = path.join(path.dirname(htmlFilename), 'clinic-flame-' + pid) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, htmlFilename), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic flame -- node - bad status code', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'flame', '--no-open', '--', 'node', '-e', 'process.exit(1)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-flame)/)[1] const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname))) t.strictEqual(stdout.split('\n')[1], 'Analysing data') t.strictEqual(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, dirname + '.html'), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic flame -- node - no issues', function (t) { // collect data cli({ relayStderr: false }, [ 'clinic', 'flame', '--no-open', '--', 'node', '-e', 'setTimeout(() => {}, 300)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const htmlFilename = stdout.match(/(\d+\.clinic-flame\.html)/)[1] const dirname = path.dirname(htmlFilename) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, htmlFilename), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic flame -- node - no issues', function (t) { // collect data cli({}, [ 'clinic', 'flame', '--no-open', '--', 'node', '-e', 'require("util").inspect(process)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-flame)/)[1] const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname))) t.strictEqual(stdout.split('\n')[1], 'Analysing data') t.strictEqual(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, dirname + '.html'), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic bubbleprof -- node - no issues', function (t) { // collect data cli({}, [ 'clinic', 'bubbleprof', '--no-open', '--', 'node', '-e', 'setTimeout(() => {}, 100)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-bubbleprof)/)[1] const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname))) t.strictEqual(stdout.split('\n')[1], 'Analysing data') t.strictEqual(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, dirname + '.html'), done) } }, function (err) { t.ifError(err) t.end() }) }) })
test('clinic doctor -- node - no issues', function (t) { // collect data cli({}, [ 'clinic', 'doctor', '--no-open', '--', 'node', '-e', 'setTimeout(() => {}, 400)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-doctor)/)[1] const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname))) t.strictEqual(stdout.split('\n')[1], 'Analysing data') t.strictEqual(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`) // check that files exists async.parallel({ sourceData (done) { fs.access(path.resolve(tempdir, dirname), done) }, htmlFile (done) { fs.access(path.resolve(tempdir, dirname + '.html'), done) } }, function (err) { t.ifError(err) t.end() }) }) })