Skip to content

cameronmcefee/jekyll-jest-example

Repository files navigation

jekyll-jest-example

This is an example of how you can test your Jekyll blog with Jest. You may find this useful if you want to:

  • Ensure specific frontmatter values are present in posts
  • Ensure authors use em dashes (—) rather than double dashes (--)
  • Ensure no blog post ever starts with “We are excited to announce”

The contents of this repo come from the boilerplate Jekyll site created via jekyll add <site>. The only notable initial change is that the templates have been moved to the src folder and _config.yml has been updated accordingly to ensure it builds from there.

This is a companion to this tutorial, so you can find code for each step in the folders of this repo. If you would like to jump right to the complete code, jump to section 5

Step Problem solved
1 Get set up
2 Expose Jekyll data
3 Report which posts fail
4 Enforce a style guide
5 Selectively test files

Getting started

This repo assumes you know what Jekyll is and already have Ruby, Node.js, and Jekyll installed.

$ cd <folder for desired step>
$ bundle install
$ npm install
$ bin/test

This will install all the dependencies you will need and run the tests.

About

An example of using Jest to test Jekyll blog content

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published