Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/jasmine
Advanced tools
TypeScript definitions for 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.
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);
});
Provides TypeScript definitions for Mocha, another popular testing framework. Like @types/jasmine, it allows TypeScript users to have type checking and IntelliSense for Mocha tests. Mocha is often considered more flexible than Jasmine, as it allows for different assertion libraries and has a simpler interface.
Offers TypeScript definitions for Jest, a testing platform that includes a test runner, assertion library, and mocking support. Jest is often used for React applications and provides a more integrated solution compared to Jasmine, which requires additional libraries for mocking and assertions.
Chai is an assertion library that can be paired with any JavaScript testing framework. The @types/chai package provides TypeScript definitions for Chai, allowing developers to use Chai's fluent API with the benefits of type safety. Unlike @types/jasmine, which is specific to the Jasmine framework, @types/chai can be used with multiple frameworks.
npm install --save @types/jasmine
This package contains type definitions for jasmine (http://jasmine.github.io).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jasmine.
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
TypeScript definitions for jasmine
The npm package @types/jasmine receives a total of 1,677,735 weekly downloads. As such, @types/jasmine popularity was classified as popular.
We found that @types/jasmine demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.