Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Assert performance metrics using phantomas
A Node.js module that uses Phantomas to run performance tests against a given URL. It features the ability perform multiple trials against the same URL and make assertions against the combined average metrics.
To get started, require the juve
module.
var juve = require('juve');
This returns a function which accepts a configuration object and a callback with the following structure.
juve({
<options>
}, function (<results>) {
...
});
Type: Number
Default value: 3
The number of times each URL will be sampled.
Type: Boolean
Default value: false
Indicates whether or not to use olympic-style scoring. This will drop the largest and smallest values for each metric before averaging the trials. Only available when the number of trials is greater than three (3).
Type: String
Default value: /
The URL to sample. This is combined with the baseUrl
option to determine the full URL that will be sampled.
The other keys of the options object can be taken directly from the phantomas documentation. The values indicate a maximum acceptable value. If multiple trials are used, the results will be averaged and compared to the asserted value.
The second argument to the juve()
function is a callback that gets called once all the trials have completed and the combined results are gathered.
The argument is an object with three array properties:
pass
: passing assertionsfail
: failed assertionstrials
: all asserted metric for each trial.The items in the pass
and fail
lists look like:
{
name: "some metric",
expected: <the asserted value>,
actual: <the actual combined average>
}
The items in the trials
list is the raw results from the underlying adapter (i.e. Phantomas).
As an alternative to passing a callback, the juve
function returns a promise that will pass the results object when resolved.
juve('http://some.site.com', {
requests: 1
}).then(function (results) {
// do some things with the results.
});
In this example, the default options are used to sample a single page from a target site. This asserts that the page does not make any extra requests.
var juve = require('juve');
juve('http://some.site.com', {
requests: 1
}, function (results) {
// do some things with the results.
});
In this example, some task options are overridden within the target. This can tighen or relax some options on a per-page basis.
var juve = require('juve');
juve('http://some.site.com', {
requests: 1,
timeToFirstByte: 200
}, function (results) {
// do stuff with the results and stuff.
});
In lieu of a formal styleguide, take care to maintain the existing coding style.
juve
function accepts the url as the first parameter.juve
function returns a promise in addition to accepting a callback.juve
function assumes all properties of the second parameter are assertions. The "options" property is reserved for specifying configuration options.(working towards v0.2.0)
FAQs
Assert performance metrics using phantomas
The npm package juve receives a total of 2 weekly downloads. As such, juve popularity was classified as not popular.
We found that juve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.