Socket
Book a DemoInstallSign in
Socket

@ni/jasmine-parameterized

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ni/jasmine-parameterized

A utility to write parameterized jasmine tests

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
16
45.45%
Maintainers
2
Weekly downloads
 
Created
Source

Jasmine Parameterized

The @ni/jasmine-parameterized library provides utility functions for writing Jasmine parameterized tests.

Getting Started

Install in your app's devDependencies:

npm install -D @ni/jasmine-parameterized

Using parameterizeSpec

Use parameterizeSpec to create a parameterized test using an array of tests with names.

In the following example:

  • the test named cats-and-dogs is focused for debugging
  • the test named frogs is configured to always be disabled
  • the test named men will run normally as it has no override
import { parameterizeSpec } from '@ni/jasmine-parameterized';
const rainTests = [
    { name: 'cats-and-dogs', type: 'idiom' },
    { name: 'frogs', type: 'idiom'},
    { name: 'men', type: 'lyrics'}
] as const;
describe('Different rains', () => {
    parameterizeSpec(rainTests, (spec, name, value) => {
        spec(`of type ${name} exist`, () => {
            expect(value.type).toBeDefined();
        });
    }, {
        'cats-and-dogs': fit,
        frogs: xit
    });
});

Using parameterizeSuite

Use parameterizeSuite to create a parameterized test suite using an array of test scenarios with names.

In the following example:

  • the suite named cats-and-dogs is focused for debugging
  • the suite named frogs is configured to always be disabled
  • the suite named men will run normally as it has no override
import { parameterizeSuite } from '@ni/jasmine-parameterized';
const rainTests = [
    { name: 'cats-and-dogs', type: 'idiom' },
    { name: 'frogs' type: 'idiom'},
    { name: 'men', type: 'lyrics'}
] as const;
parameterizeSuite(rainTests, (suite, name, value) => {
    suite(`with ${name}`, () => {
        it('expect type to be defined', () => {
            expect(value.type).toBeDefined();
        });

        it('expect type to have a non-zero length', () => {
            const length = value.type.length;
            expect(length).toBeGreaterThan(0);
        });
    });
}, {
    'cats-and-dogs': fdescribe,
    frogs: xdescribe
});

Contributing

See Getting Started in CONTRIBUTING.md.

Keywords

jasmine

FAQs

Package last updated on 16 Jul 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.