Socket
Socket
Sign inDemoInstall

@types/jasmine

Package Overview
Dependencies
0
Maintainers
1
Versions
178
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/jasmine

TypeScript definitions for jasmine


Version published
Weekly downloads
2.4M
increased by0.71%
Maintainers
1
Install size
56.5 kB
Created
Weekly downloads
 

Package description

What is @types/jasmine?

The @types/jasmine npm package provides TypeScript type definitions for Jasmine, a behavior-driven development framework for testing JavaScript code. It does not contain the actual Jasmine framework but includes type declarations that allow TypeScript developers to use Jasmine with type checking and IntelliSense support in their IDEs.

What are @types/jasmine's main functionalities?

Describing test suites

This feature allows you to group together related tests into a test suite. Each suite starts with a call to the global Jasmine function `describe` with two parameters: a string and a function. The string is the title of the test suite, and the function is the block of code that implements the suite.

describe('A suite', () => {
  it('contains spec with an expectation', () => {
    expect(true).toBe(true);
  });
});

Writing test specifications

This feature is used to write individual test cases or specifications. The `it` function takes a string describing the test and a function that contains the test's code. The `expect` function is used to make an assertion about the expected outcome of the test.

it('is true', () => {
  expect(true).toBe(true);
});

Setting up and tearing down

This feature allows you to define setup (`beforeEach`) and teardown (`afterEach`) methods that are called before and after each test spec in a suite, respectively. This is useful for creating a clean environment for each test to run in.

describe('A suite', () => {
  beforeEach(() => {
    // Setup code here
  });

  afterEach(() => {
    // Teardown code here
  });

  it('test case', () => {
    // Test code here
  });
});

Asynchronous support

This feature allows you to test asynchronous code. You can pass a `done` callback to the `it` function and call it when your asynchronous code has completed. This signals to Jasmine that the test should wait for the asynchronous code to finish before considering the test complete.

it('async test', (done) => {
  setTimeout(() => {
    expect(true).toBe(true);
    done();
  }, 1000);
});

Other packages similar to @types/jasmine

Readme

Source

Installation

npm install --save @types/jasmine

Summary

This package contains type definitions for jasmine (http://jasmine.github.io).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jasmine.

Additional Details

  • Last updated: Wed, 22 Nov 2023 00:24:48 GMT
  • Dependencies: none

Credits

These definitions were written by Boris Yankov, Theodore Brown, David Pärsson, Lukas Zech, Boris Breuer, Chris Yungmann, Giles Roadnight, Yaroslav Admin, Domas Trijonis, Moshe Kolodny, Stephen Farrar, Dominik Ehrenberg, Chives, kirjs, and Dmitry Semigradsky.

FAQs

Last updated on 22 Nov 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc