0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00
ghost/test/utils/fixtures/themes/README.md
Hannah Wolfe 2ea7d5432b
Updated casper test fixture to latest version
closes: https://github.com/TryGhost/Toolbox/issues/193

- Our Casper fixture was several years out of date.
- I'd already updated the ghost-api to point to the latest API version, which was the main difference
- This makes sure the full fixture is up to date and correct, and therefore that we're truly testing if Ghost right now works
- It also adds instructions for how to update it in future

GOTCHA: the mock-express-style tests are failing if the API difference between test-theme and casper are different
- I've tried to look into why this is - it's something to do with the overridden route settings not working properly if the API version changes
- Given that we may not keep this style of testing AND we are definitely not keeping API versions, I'm ignoreing this for now
- To get around it, I'm setting both themes to be v4 API, so that Casper is exactly as in main
2022-01-25 14:10:53 +00:00

23 lines
1.3 KiB
Markdown

# 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, make sure you are in side this folder (the fixtures/themes directory) and run:
`rsync -rv --exclude '.git*' --exclude 'assets/css*' --exclude 'assets/js*' --exclude 'gulpfile.js' --exclude 'yarn.lock' --exlcude '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: `zip -r valid.zip ./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