Skip to content

Enable passing of a custom userDataDir to launcher#2357

Merged
paulirish merged 4 commits intomasterfrom
allow-custom-profile
Jun 5, 2017
Merged

Enable passing of a custom userDataDir to launcher#2357
paulirish merged 4 commits intomasterfrom
allow-custom-profile

Conversation

@samccone
Copy link
Contributor

@samccone samccone commented May 25, 2017

  • rename TMP_DIR to a more accurate name. Since this is a private
    internal value, this is non-breaking.

Fixes #2291
Ref #2092

@samccone samccone requested a review from paulirish May 25, 2017 02:44
@samccone samccone force-pushed the allow-custom-profile branch from 1f0d10f to e5d597b Compare May 25, 2017 02:49
@samccone
Copy link
Contributor Author

CI failure is just due to flake.

@paulirish
Copy link
Member

✅ Confirmed it works via adding a userDataDir option into the https://github.com/GoogleChrome/lighthouse/blob/master/docs/readme.md#using-programmatically example.

doesn't delete if passed a custom path. clears the profile if we generated.

Nice!

@paulirish
Copy link
Member

Tests? wdyt

@wardpeet
Copy link
Collaborator

would be nice to test this on appveyor 😄

@samccone samccone force-pushed the allow-custom-profile branch from e5d597b to dac6532 Compare May 31, 2017 03:21
@samccone
Copy link
Contributor Author

samccone commented May 31, 2017

Added some simple tests @paulirish.

To test the destroy tmp, I am going to have to do some more heavy handed refactors, let me know what you think so far before I keep going.

@paulirish
Copy link
Member

We discussed offline:

  • Don't install the .chrome property on the launcher instance. if anything it should be in the return object of launch()
  • move if (this.opts.userDataDir === undefined) { to inside of destroyTmp so you can test that without faking a close event and a this.chrome interface.
  • verify tmpdir is deleted when it should be and not deleted when it shouldnt be

@samccone samccone force-pushed the allow-custom-profile branch 2 times, most recently from f65eb0b to ad404e0 Compare June 2, 2017 22:30
"build": "tsc",
"dev": "tsc -w",
"test": "mocha --reporter dot test/**/*-test.js",
"test": "mocha -r ts-node/register --reporter dot test/**/*-test.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expand to --require

samccone added 3 commits June 5, 2017 09:31
* rename TMP_DIR to a more accurate name. Since this is a private
internal value, this is non-breaking.

Fixes #2291
* Refactor code bits to make testable.
* Add the ability for a user to pass in module mocks to enable testing.
@samccone samccone force-pushed the allow-custom-profile branch from ad404e0 to 98110d8 Compare June 5, 2017 17:17
"build": "tsc",
"dev": "tsc -w",
"test": "mocha --reporter dot test/**/*-test.js",
"tests": "mocha -r ts-node/register --reporter dot test/**/*-test.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove yarn test ? Would prefer to continue the convention..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests -> test. here and in run_mocha

"build": "tsc",
"dev": "tsc -w",
"test": "mocha --reporter dot test/**/*-test.js",
"tests": "mocha -r ts-node/register --reporter dot test/**/*-test.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use --require instead of -r ?

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm % last comments.

@samccone samccone force-pushed the allow-custom-profile branch from 98110d8 to a05e85d Compare June 5, 2017 22:21
@samccone
Copy link
Contributor Author

samccone commented Jun 5, 2017

updated

@paulirish paulirish merged commit a9f5785 into master Jun 5, 2017
@paulirish paulirish deleted the allow-custom-profile branch June 5, 2017 22:24
@samccone
Copy link
Contributor Author

samccone commented Jun 6, 2017

Thanks everyone for the reviews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants