Grunt plugin for benchmarking node.js modules that allows performance to be compared to an established baseline.
This plugin requires Grunt ~0.4.5
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-baseline --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-baseline');
This is a Grunt plugin for Baseline, a benchmarking framework for node.js. Baseline allow the results of a test run to be saved and used to determine if performance changes in the future. Alternatively, tests can be compared against each other. Baseline supports both synchronous and asynchronous tests using a simple syntax. For more information see the documentation.
In your project's Gruntfile, add a section named baseline
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
baseline: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
}
}
});
Type: number
Default value: 10
The minimum percent difference from baseline that is reported as a change.
Type: number
Default value: 2
The minimum time a test runs in seconds
Type: number
Default value: 6000
Maximum execution time for an asynchronous action, in milliseconds.
Type: string
Full path to file to use for saved baseline.
Type: boolean
Default value: false
Indicates whether or not the saved baseline file should be updated.
Type: boolean
Indicates whether or not to use colors in reporter. If undefined, colors are used if supported in the terminal.
Type: string
Default value: default
See Baseline documentation for information on available reporters.
If a value is not a built-in reporter, the task tries to a load a CommonJS module with the specified name and use that module as the reporter.
Type: boolean
Default value: false
Fails the build script if any tests are slower than the baseline.
grunt.initConfig({
baseline: {
tests: {
src: [
"**/*.bench.js"
]
}
}
});
grunt.initConfig({
baseline: {
tests: {
options: {
reporter: 'minimal'
},
src: [
"**/*.bench.js"
]
}
}
});
grunt.initConfig({
baseline: {
tests: {
options: {
baselinePath: 'baseline.json',
failIfSlower: true
},
src: [
"**/*.bench.js"
]
}
}
});