Ghost/ghost/core/test/utils/fixtures/themes
Chris Raible 5a5a756415
Updated theme fixtures for casper and source (#18677)
no issue

- Casper and Source theme files were out of date — this commit updates the theme fixtures, and fixes up a few tests to pass with the updated themes
2023-10-18 14:51:35 -07:00
..
broken-theme Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
casper Updated theme fixtures for casper and source (#18677) 2023-10-18 14:51:35 -07:00
locale-theme Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
members-test-theme Fixed the typo 2022-08-04 15:38:32 +01:00
source Updated theme fixtures for casper and source (#18677) 2023-10-18 14:51:35 -07:00
test-theme 🐛 Updated gscan error handling for page errors (#17575) 2023-08-02 09:56:40 -05:00
test-theme-channels Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
casper.zip Updated theme fixtures for casper and source (#18677) 2023-10-18 14:51:35 -07:00
invalid.zip Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
README.md Updated theme fixtures for casper and source (#18677) 2023-10-18 14:51:35 -07:00
source.zip Updated theme fixtures for casper and source (#18677) 2023-10-18 14:51:35 -07:00
valid.zip Enabled page features (#17544) 2023-07-31 14:22:19 -05:00
warnings.zip 🐛 Updated gscan error handling for page errors (#17575) 2023-08-02 09:56:40 -05:00

Theme Fixtures

These files are used throughout our tests to mock themes in various states.

Updating the Casper theme fixture

The casper fixture is a partial copy of the content/themes/casper folder. It should not include any files that aren't needed to run the theme.

To update it:

  1. Ensure your content/themes/casper folder is on the latest released version e.g.
  • Run yarn main
  • cd content/themes/casper
  • git log -20 - find the latest tag
  • git checkout vx.y.z - checkout the latest tag
  1. Ensure you are in side this folder (the fixtures/themes directory), remove casper entirely and then copy it across fresh:
  • cd tests/utils/fixtures/themes
  • rm -rf casper
  • rsync -rv --exclude '.git*' --exclude 'assets/css*' --exclude 'assets/js*' --exclude 'gulpfile.js' --exclude 'yarn.lock' --exclude 'README.md' --exclude 'node_modules' ../../../../content/themes/casper .

Updating the Source theme fixture

The source fixture is a partial copy of the content/themes/source folder. It should not include any files that aren't needed to run the theme.

To update it:

  1. Ensure your content/themes/source folder is on the latest released version e.g.
  • Run yarn main
  • cd content/themes/source
  • git log -20 - find the latest tag
  • git checkout vx.y.z - checkout the latest tag
  1. Ensure you are in side this folder (the fixtures/themes directory), remove source entirely and then copy it across fresh:
  • cd tests/utils/fixtures/themes
  • rm -rf source
  • rsync -rv --exclude '.git*' --exclude 'assets/css*' --exclude 'assets/js*' --exclude 'gulpfile.js' --exclude 'yarn.lock' --exclude 'README.md' --exclude 'node_modules' ../../../../content/themes/source .

Modifying theme fixtures

When a new rule is introduced in gscan one of these fixture files might break and you'll have to update a "zip" which isn't as easy as opening a text editor... It could become that one day but for now here are some commands to help out with the edit process

  • Unzip the theme files, e.g.: cd $CURRENT_DIR && unzip valid.zip -d valid
  • Make a change in the file which caused a warning/error/whatever
  • Zip the files back: cd valid; zip -r ../valid.zip * ; cd ..
  • Clean up rm -rf ./valid
  • Commit changed zip file: git add valid.zip ;... you know the drill :)

Ideas for future improvements in theme tests:

  • Decouple tests from file system as much as possible
  • Track contents of what is in "zips" in source control. Right now, having a diff on a binary file is not useful at all