@jest/types
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@jest/schemas | 29.6.3 | 1.94 kB | MIT | prod | |
@types/istanbul-lib-coverage | 2.0.6 | 2.1 kB | MIT | prod | |
@types/istanbul-reports | 3.0.4 | 2.12 kB | MIT | prod | |
@types/node | 20.12.8 | 1.96 MB | MIT | prod | |
@types/yargs | 17.0.32 | 14.18 kB | MIT | prod | |
chalk | 4.1.2 | 11.31 kB | MIT | prod |
The @jest/types
npm package provides shared types for Jest's packages. These shared types enhance the ease with which developers can use and navigate Jest. Integration of @jest/types
promotes a structured and well-formatted scripting environment, enhancing the readability and functionality of your testing framework in JS projects.
Using @jest/types
in your JavaScript code requires importing the relevant components from the package. For instance, to import globals such as 'describe', 'expect', and 'it', you would execute the code:
import {describe, expect, it} from '@jest/globals';
describe('my tests', () => {
it('works', () => {
expect(1).toBe(1);
});
});
Similarly, for a typed Jest config which isn't offered in Jest by default, you would import the Config
module from @jest/types
as demonstrated below:
// jest.config.ts
import {Config} from '@jest/types';
const config: Config.InitialOptions = {
// some typed config
};
export default config;
These examples illustrate how seamlessly @jest/types
integrates with your code, optimising Jest functionalities.
The documentation for the @jest/types
package is available in the official Jest documentation. Additionally, for third-party type definitions maintained by DefinitelyTyped, you can find information on the @types/jest package and its repository on GitHub. Always ensure to check these sources for the most up-to-date usage protocols and practices.