mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
- I noticed our test fixture theme was still throwing errors during tests because it had partials that are no longer in use - Updated the docs on how to update Casper to include ensuring Casper was on a valid version AND removing Casper before copying it across - Performed the exact steps in the README - This ensures that the Casper version we use in our tests is not throwing tonnes of errors and is up to date
34 lines
1.6 KiB
Markdown
34 lines
1.6 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:
|
|
|
|
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
|
|
|
|
2. 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: `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
|