vitest-plugin-context weekly downloads statistics
By OutOfOrder (3 listings) · npm · Testing
Exposes a context alias for describe to vitest.
vitest-plugin-context has 2 recorded weekly downloads on npm, a decrease of 71.4% over the past 30 days, ranking #2290 of 2,322 tracked listings.
About vitest-plugin-context
vitest-plugin-context
Adds context as an alternative to describe for vitest
Getting Started
Install vitest-plugin-context using yarn:
yarn add --dev vitest-plugins
yarn add --dev vitest-plugin-context
Motivation
RSpec took the ruby world by storm with its declarative method of TDD. In RSpec, describe it used to wrap a set of tests against one functionality while context is to wrap a set of tests against one functionality under the same state.
The difference being you should only describe to test the User model and specifically describe the #name method. However, testing different states of the #name method should use different context. You can view an example of this below.
Usage
If you want, you can import context from vitest-plugin-context at the top of every test:
import { context } from 'vitest-plugin-context';
If you want to install context as a global, you can modify the test section of your vitest.config.js to include:
{
test: {
setupFiles: [
"vitest-plugin-context/setup",
]
}
}
Example
Here's an example test that uses context and set:
import { describe, it, expect } from 'vitest';
import { set } from 'vitest-plugin-set';
import { context } from 'vitest-plugin-context';
import User from '../user';
describe('User', () => {
describe('#name', () => {
set('firstName', () => 'Harry');
set('lastName', () => 'Potter');
set('user', () => new User({firstName, lastName}));
context('with blank first name', () => {
set('firstName', () => null);
it('should return only the last name', () => {
expect(user.name).toEqual('Potter');
});
});
context('with blank last name', () => {
set('lastName', () => null);
it('should return only the first name', () => {
expect(user.name).toEqual('Harry');
});
});
});
});
Description from the npm listing.
- context
- vitest
- vitest-plugin
- plugin
- test
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (544)Similar npm Testing plugins
All 20 vitest-plugin-context alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vitest-plugin-context. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.