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

test(docs): improve style guide URL path test #641

Merged
merged 9 commits into from
Jan 9, 2019

Conversation

shawnbot
Copy link
Contributor

@shawnbot shawnbot commented Jan 9, 2019

This refactors our docs site test command to more intelligently list the Primer-specific paths from the Style Guide site with the ones in our pages/css directory.

In a nutshell: Rather than hacking together a path list with the file command, there is a Node script that looks at a list of paths committed to before.txt (or, if running locally, it looks for a github/styleguide checkout, builds the site, and generates a new before.txt from the list of built paths — and compares it to the list of "pages" in pages/css. The test script fails if there are paths in the former that don't exist in the latter, and which aren't accounted for by any "exceptions" (see below).

Exceptions

Because we're changing some URLs, there are bound to be paths that don't match up. I thought it'd be good to explicitly list these in a way that's easy to understand, is testable, and helps us add the correct redirects from the styleguide when we're ready to decommission it. The exceptions object in docs/test/urls.js does this, e.g. to account for the status key move in #635:

const exceptions = {
  '/whats_new/status-key': moved('/status-key')
}

This could be read as:

The Primer style guide path /whats_new/status-key (/primer/whats_new/status-key) has moved to to /status-key in the Primer CSS docs site (/css/status-key).

Once this PR passes CI, I think it's fair to say that we've accounted for most of the Primer pages in the style guide and "documented" any that aren't going to exist in the new site, checking off a bunch of boxes in #628. 🎉

@shawnbot shawnbot changed the title docs: improve URL style guide URL path test docs: improve style guide URL path test Jan 9, 2019
@shawnbot shawnbot changed the title docs: improve style guide URL path test tests: improve style guide URL path test Jan 9, 2019
@shawnbot shawnbot changed the title tests: improve style guide URL path test test: improve style guide URL path test Jan 9, 2019
@shawnbot shawnbot mentioned this pull request Jan 9, 2019
14 tasks
@shawnbot shawnbot changed the title test: improve style guide URL path test test(docs): improve style guide URL path test Jan 9, 2019
@shawnbot

This comment has been minimized.

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

Looks ok to me

docs/package.json Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants