Skip to content
PluginStats

vitest-plugin-set weekly downloads statistics

By OutOfOrder (3 listings) · npm · Testing

Declarative JS tests with lazy evaluation using vitest.

View on npm Fresh · Dec 6, 2026

vitest-plugin-set has 8 recorded weekly downloads on npm, an increase of 100% over the past 30 days, ranking #3180 of 3,247 tracked listings.

Weekly downloads
8
Official API · Dec 5, 2026
7-day growth
+60.0%
+3 weekly downloads
30-day growth
+100%
+4 weekly downloads
90-day growth
0.0%
0 weekly downloads
Rank
#3180
▼ 55 in 7 days

About vitest-plugin-set

vitest-plugin-set

npm npm npm

Declarative JS tests with lazy evaluation for vitest.

Getting Started

Install vitest-plugin-set using yarn:

yarn add --dev vitest-plugins
yarn add --dev vitest-plugin-set

Motivation

RSpec took the ruby world by storm with its declarative method of TDD. Since moving to JavaScript, I've wanted a similar way of declaring the setup for my tests. Here's what you would normally do to declare a test:

describe('User', () => {
  let user;

  describe('.update', () => {
    beforeEach(() => {
      user = new User({firstName: 'Mary', lastName: 'Lamb'});
    });

    describe('with valid firstName and lastName', () => {
      let firstName;
      let lastName;

      beforeEach(() => {
        firstName = 'Test';
        lastName = 'User';
        user.update({firstName, lastName});
      });

      it('should set firstName', () => {
        expect(user.firstName).toEqual('Test');
      });

      it('should compute name', () => {
        expect(user.name).toEqual('Test User');
      });
    });

    describe('with invalid firstName', () => {
      let firstName;
      let lastName;

      beforeEach(() => {
        firstName = null;
        lastName = null;
        user.update({firstName, lastName});
      });

      it('should not override the original firstName', () => {
        expect(user.firstName).toEqual('Mary');
      });
    });
  });
});

Some notes:

  1. Because of scoping in javascript, we have to declare our variables outside the beforeEach blocks in order to reference them.
  2. Our beforeEach blocks contain all of the setup code necessary which in this trivial example is at least 3 lines per test.
  3. We can override variables in nested scopes, but following the chain is non-trivial because the actual variable declaration might be several layers up.

Here's what the same tests look like with using set from vitest-plugin-set:

describe('User', () => {
  describe('.update', () => {
    set('user', () => new User({firstName: 'Mary', lastName: 'Lamb'}));

    describe('with valid firstName and lastName', () => {
      set('firstName', () => 'Test');
      set('lastName', () => 'User');

      beforeEach(() => user.update({firstName, lastName}));

      it('should set firstName', () => {
        expect(user.firstName).toEqual('Test');
      });

      it('should compute name', () => {
        expect(user.name).toEqual('Test User');
      });
    });

    describe('with invalid firstName', () => {
      set('firstName', () => null);
      set('lastName', () => null);

      beforeEach(() => user.update({firstName, lastName}));

      it('should not override the original firstName', () => {
        expect(user.firstName).toEqual('Mary');
      });
    });
  });
});

Even in this trivial example, things are much easier to follow.

  1. We can declare firstName and lastName as variables that we can then reference in our beforeEach blocks.
  2. We can break up the large beforeEach blocks into several distinct set blocks.
  3. We can easily set defaults in outer scopes (which may or may not be used within a particular test saving performance) and then overriding the values in nested blocks.

Why set?

In JavaScript, let is a keyword so the next closest word is...set (which still keeps the meaning of what we're doing

  • settings variables (lazily)).

Usage

If you want, you can import set from vitest-plugin-set at the top of every test:

import {set} from 'vitest-plugin-set';

If you want to install set as a global, you can modify the test section of your vitest.config.js to include:

{
  test: {
    setupFiles: [
      "vitest-plugin-set/setup",
    ]
  }
}

Example

Here's an example test that tests set itself:

import {describe, it, expect} from 'vitest';
import {set} from 'vitest-plugin-set';

describe('set', () => {
  set('a', () => 1);
  set('b', () => 2);
  set('c', () => 'hello world');

  describe('variables set to primitives', () => {
    it('should set a', () => {
      expect(a).toEqual(1);
    });

    it('should set b', () => {
      expect(b).toEqual(2);
    });

    it('should set c', () => {
      expect(c).toEqual('hello world');
    });
  });

  describe('variables set to arrays', () => {
    set('a', () => [1, 2, 3]);

    it('should properly set arrays', () => {
      expect(a).toEqual([1, 2, 3]);
    });
  });

  describe('variables set to objects', () => {
    set('b', () => ({test: '1', value: 2, other: 'three'}));

    it('should properly set objects', () => {
      expect(b).toEqual({other: 'three', value: 2, test: '1'});
    });
  });

  describe('nested set calls', () => {
    set('a', () => 10);

    it('should take the inner set', () => {
      expect(a).toEqual(10);
    });
  });

  describe('variables set within other set calls', () => {
    set('b', () => a + 10);

    it('should evaluate outer variables', () => {
      expect(b).toEqual(11);
    });

    it('should be able to reference variables from the outer scope', () => {
      expect(c).toEqual('hello world');
    });
  });
});

Description from the npm listing.

  • declarative
  • let
  • set
  • tdd
  • 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

vitest-plugin-set weekly downloads on npm, last 90 days: 8 weekly downloads as of Dec 5, 2026, 0.0% over 90 days.vitest-plugin-setWeekly downloads on npm · Last 90 days8downloads / week0.0% over 90 days024681012Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vitest-plugin-set weekly downloads on npm, last 90 days: 8 weekly downloads as of Dec 5, 2026, 0.0% over 90 days.

7/30/90-day growth

vitest-plugin-set weekly downloads growth on npm: +60.0% over 7 days, +100% over 30 days, 0.0% over 90 days.vitest-plugin-setWeekly downloads growth on npm8downloads / week now7-day growth+3 weekly downloads+60.0%30-day growth+4 weekly downloads+100%90-day growth+0 weekly downloads0.0%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vitest-plugin-set weekly downloads growth on npm: +60.0% over 7 days, +100% over 30 days, 0.0% over 90 days.

Ranking history

vitest-plugin-set npm ranking history: currently #3180 (by weekly downloads).vitest-plugin-setnpm ranking · by weekly downloads · Last 90 days#3180current rank#2000#2200#2400#2600#2800#3000#3200Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vitest-plugin-set npm ranking history: currently #3180 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 160, #2 (overall #3,182)
All npm: every listing in weekly downloads order

Listing placement

Testing26 listings · 2 pages · page 2, #4 (overall #24)
Testing: every listing in weekly downloads order

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 (170)
Recent weekly downloads observations for vitest-plugin-set
Date (UTC)Weekly downloadsChange vs. previous
80
8-1
90
9+3
6+3
30
3-2
5-2
7-4
11-1
120
120
12+1
11—

Similar npm Testing plugins

All 20 vitest-plugin-set alternatives

Data 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-set. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.