Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(scripts): more useful lantern debugging output #5517

Merged
merged 3 commits into from
Jun 19, 2018

Conversation

patrickhulce
Copy link
Collaborator

so lantern tests have been great canary but not all that helpful for debugging :) the git diff didn't always include the URL you needed to look at, it included a lot of lines that weren't relevant, and didn't give clear priority to the most affected URLs

this makes a few tweaks and adds a debug script

new output of the assert-* script:
image

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.

didn't look closely, but i dont want to block ya

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM, just some comments on tsc stuff.

Directions for these various scripts would probably be good to add at some point :)

const constants = require('./constants');

// @ts-ignore
const chalk = require('chalk');
Copy link
Member

Choose a reason for hiding this comment

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

chalk isn't in our deps, is that on purpose? (chalk also added its own types at some point, it looks like, though our transitive dep chalk is stuck on an old version)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah mostly didn't want to bulk it up, but you prefer I add it? I can depend a newer one with types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

const computedResults = require(HEAD_PATH);
const expectedResults = require(MASTER_PATH);

/** @type {{url: string, maxDiff: number, diffsForSite: DiffForSite[]}[]} */
Copy link
Member

Choose a reason for hiding this comment

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

this seems like a case for old-fashioned Array<>, at least in the surrounding block :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

heh, alright done :)

/** @type {{url: string, maxDiff: number, diffsForSite: DiffForSite[]}[]} */
const diffs = [];
for (const entry of computedResults.sites) {
// @ts-ignore - should always exist
Copy link
Member

Choose a reason for hiding this comment

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

what should always exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

fs.unlinkSync(TMP_HEAD_PATH);
fs.unlinkSync(TMP_MASTER_PATH);
const computedResults = require(HEAD_PATH);
const expectedResults = require(MASTER_PATH);
Copy link
Member

Choose a reason for hiding this comment

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

since master is constant, would it be better to require it directly so the compiler can pick it up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so unless I'm misunderstanding. TS just seems to put on a compiler error on the JSON for not being a module and then we have to copy/paste the path around...?

const RUN_ONCE_PATH = path.join(__dirname, 'run-once.js');

const siteIndex = require(SITE_INDEX_PATH);
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

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

whats being ignored?

@patrickhulce patrickhulce merged commit aeda7c8 into master Jun 19, 2018
@patrickhulce patrickhulce deleted the more_helpful_lantern_test_output branch June 19, 2018 01:57
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