Verify that your images are correctly resized for different resolutions Updated to log files with wrong dimensions
This plugin requires Grunt ~0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-image-check --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-image-check');
In your project's Gruntfile, add a section named image_check
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
image_check: {
your_target: {
// Target-specific options
},
},
});
Type: String
Path to a folder where the images that are going to be used as baseline live
Type: String
A minimatch pattern that will be used to chose the files we actually want to compare. All files not matching the pattern will be ignored
Type: Array
Array of objects representing the folders you want to compare against. The format of the object is:
{
path: 'Path to the folder where the resized images live',
proportion: 'Proportion you expect images in the given path to have compared to the baseline. If it is 2, then you expect images to be twice as large.'
}
grunt.initConfig({
image_check: {
retina: {
baseline: 'images/1x/',
compare: [
{
path: 'images/2x/',
proportion: 2
}
]
}
},
});
To run all the tests use this command:
grunt test
We have a few integration tests where we expect the task to fail. For these scenarios we use a special flag: negateOutput
to return true when the task fails and false when the task passes.
We use mocha for our unit tests. You can find them under tests/unit/