Ghost/test/utils/fixtures/themes
Naz 7d03194e55 Added detection of "ghost-api" use in theme config
refs https://github.com/TryGhost/Toolbox/issues/241

- The `engines.ghost-api` property has been deprecated and the support for it will be dropped in Ghost v5 due to versionless nature of the Content API.
- When uploading a new theme or activating existing one that uses ghost-api in it's config a warning will be shown to the user
2022-03-24 15:27:40 +13:00
..
broken-theme Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00
casper Updated fixture Casper@v4.7.2 & corrected README 2022-02-15 15:42:14 +00:00
locale-theme Upgraded remaining theme fixtures to canary API 2022-01-24 21:55:13 +00:00
members-test-theme Upgraded remaining theme fixtures to canary API 2022-01-24 21:55:13 +00:00
test-theme Updated casper test fixture to latest version 2022-01-25 14:10:53 +00:00
test-theme-channels Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00
casper.zip Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00
invalid.zip Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00
README.md Added detection of "ghost-api" use in theme config 2022-03-24 15:27:40 +13:00
valid.zip Added detection of "ghost-api" use in theme config 2022-03-24 15:27:40 +13:00
warnings.zip Move tests from core to root (#11700) 2020-03-30 16:26:47 +01: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' ../../../../content/themes/casper .

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