Skip to content

Commit

Permalink
better tmp directory inspired by #9855
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Oct 25, 2019
1 parent 1efd5f9 commit 321d038
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@
'use strict';

const fs = require('fs').promises;
const path = require('path');
const os = require('os');
const {promisify} = require('util');
const execFileAsync = promisify(require('child_process').execFile);

const log = require('lighthouse-logger');
const rimraf = promisify(require('rimraf'));
const makeDir = require('make-dir');

const assetSaver = require('../../../../lighthouse-core/lib/asset-saver.js');
const LocalConsole = require('../local-console.js');
const ChildProcessError = require('./child-process-error.js');

/**
* Launch Chrome and do a full Lighthouse run via the CLI.
* Launch Chrome and do a full Lighthouse run via the Lighthouse CLI.
* @param {string} url
* @param {LH.Config.Json=} configJson
* @param {{isDebug?: boolean}=} testRunnerOptions
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
*/
async function runLighthouse(url, configJson, testRunnerOptions = {}) {
const randInt = Math.round(Math.random() * 100000);
const tmpAbsolutePath = await makeDir(`./.tmp/smokehouse-${randInt}/`);
const tmpPath = path.relative(process.cwd(), tmpAbsolutePath);
const tmpPath = await fs.mkdtemp(`${os.tmpdir()}/smokehouse-`);

const {isDebug} = testRunnerOptions;
return internalRun(url, tmpPath, configJson, isDebug)
Expand Down

0 comments on commit 321d038

Please sign in to comment.