Configuring PerfLint
To configure PerfLint you should add your desired rules into a .perflintrc
file. This will set rules for an entire directory and all of its subdirectories.
PerfLint checks the current working directory first as a starting point when looking for a configuration file. Alternatively you could can specify a specific configuration file via the CLI.
Rules
For a list of available rules see the Rules doc.
When setting rules you can specify the parameters to which a check should pass, and also whether that rules should flag as an 'error' or 'warning'.
Check for too many warnings
Setting the
maxWarnings
parameter in the CLI will allow you to trigger a nonzero exit code if there are too many warnings.
Check if a result is greater than expected
This will check to see if the result is less than the max
value specified.
{
"rules": {
"SpeedIndex": [{ "max": 2000 }, "error"]
}
}
Check if a result is less than expected
This will check to see if the result is less than the min
value specified.
{
"rules": {
"requestsJS": [{ "min": 1 }, "warning"]
}
}
Check if a result is within a range of values
This will check to see if the result is within a range of values, it will validate on max
before min
.
{
"rules": {
"requestsDoc": [{ "min": 3, "max": 30 }, "warning"]
}
}
Check if a result matches expected value
This will check to see if a result matches exactly with the value specified.
{
"rules": {
"responses_404": [0, "error"]
}
}
Test Settings
URL(s)
If the --url
parameter is not set in the CLI it must be set in the config.
Single URL
{
"URL": "http://example.com",
"rules": {...}
}
Multiple URLs
{
"URL": ["http://example.com", "http://example.com/page2"],
"rules": {...}
}
Private Test
Define if the test should be hidden from the test log.
Default: false
{
"private": true,
"rules": {...}
}
Test Location
Valid Test Locations
A list of valid locations can be viewed at WebPageTest API Locations.
Define specific test location.
Default: 'Dulles:Chrome'
{
"location": "Dulles:Chrome",
"rules": {...}
}
Test Connectivity
Define connectivity speed to test URL.
Default: 'Cable'
Available Connections
- Cable
- DSL
- FIOS
- Dial
- 3G
- 3GFast
- Native
{
"connectivity": "Cable",
"rules": {...}
}
Test Label
Specify a 'label' for the test.
Default: 'PerfLint Test'
{
"label": "Custom Test Label",
"rules": {...}
}
Result Filters
Be aware when changing 'average' and 'view'
Not all 'averages' and 'views' have all rules available.
Specify which results are parsed.
{
"average": "median",
"view": "firstView",
"rules": {...}
}
Default Filters
If no values are specified, the defaults are;
average: 'median'
view: 'firstView'
Available Filters
### 'average'
- average
- standardDeviation
- median
### 'view'
- firstView
- repeatView
Updated less than a minute ago