Jest Platform
Tool for identifying modified files in a git/hg repository. Exports two functions:
- returns a promise that resolves to an object with the changed files and repos.
findRepos
returns a promise that resolves to a set of repositories contained in the specified path.
You can read more about jest-changed-files
in the readme file.
jest-diff
Tool for visualizing changes in data. Exports a function that compares two values of any type and returns a “pretty-printed” string illustrating the difference between the two arguments.
例子
const diff = require('jest-diff');
const a = {a: {b: {c: 5}}};
const b = {a: {b: {c: 6}}};
const result = diff(a, b);
// print diff
console.log(result);
You can read more about jest-docblock
in the .
jest-get-type
Module that identifies the primitive type of any JavaScript value. Exports a function that returns a string with the type of the value passed as argument.
例子
const getType = require('jest-get-type');
const nullValue = null;
const undefinedValue = undefined;
// prints 'array'
console.log(getType(array));
// prints 'null'
console.log(getType(nullValue));
console.log(getType(undefinedValue));
用于验证用户提交的配置的工具。 Exports a function that takes two arguments: the user’s configuration and an object containing an example configuration and other options. The return value is an object with two attributes:
hasDeprecationWarnings
, a boolean indicating whether the submitted configuration has deprecation warnings,isValid
, 一个布尔值, 指示配置是否正确。
jest-worker
用于任务并行化的模块。 Exports a class JestWorker
that takes the path of Node.js module and lets you call the module’s exported methods as if they were class methods, returning a promise that resolves when the specified method finishes its execution in a forked process.
例子
// heavy-task.js
module.exports = {
myHeavyTask: args => {
// long running CPU intensive task.
},
};
You can read more about jest-worker
in the readme file.
Exports a function that converts any JavaScript value into a human-readable string. Supports all built-in JavaScript types out of the box and allows extension for application-specific types via user-defined plugins.
const prettyFormat = require('pretty-format');
const val = {object: {}};
val.circularReference = val;
val[Symbol('foo')] = 'foo';
val.map = new Map([['prop', 'value']]);
val.array = [-0, Infinity, NaN];