Jest 平台工具

    用于识别 git/hg 存储库中已修改文件的工具。 导出两个函数:

    • 返回一个resolved状态的Promise,此Promise包含修改文件和仓库信息。
    • findRepos 返回一个resolved状态的Promise,此Promise包含指定路径的一组仓库数据。

    获取更多信息,请关注jest-changed-files中的 Readme

    jest-diff

    数据更改的可视化工具。 输出一个函数,两个任何类型的值输入该函数后,返回一个“较易读”的字符串来展现其区别。

    例子

    1. const {diff} = require('jest-diff');
    2. const a = {a: {b: {c: 5}}};
    3. const b = {a: {b: {c: 6}}};
    4. const result = diff(a, b);
    5. // print diff
    6. console.log(result);

    Tool for extracting and parsing the comments at the top of a JavaScript file. Exports various functions to manipulate the data inside the comment block. Exports various functions to manipulate the data inside the comment block.

    jest-get-type

    Module that identifies the primitive type of any JavaScript value. 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.

    例子

    1. const {getType} = require('jest-get-type');
    2. const nullValue = null;
    3. const undefinedValue = undefined;
    4. // prints 'array'
    5. console.log(getType(array));
    6. // prints 'null'
    7. console.log(getType(nullValue));
    8. 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: The return value is an object with two attributes:

    • hasDeprecationWarnings, a boolean indicating whether the submitted configuration has deprecation warnings,
    • isValid, 一个布尔值, 指示配置是否正确。

    You can read more about jest-validate in the .

    jest-worker

    用于任务并行化的模块。 导出一个 Worker 类,传入 Node.js 的路径,可以让你调用模块导出的方法,就像是这个类的方法一样,返回一个承诺,当指定的方法在分支进程里执行完成的时候就会解析。

    例子

    1. module.exports = {
    2. // long running CPU intensive task.
    3. },
    4. };

    main.js

    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. Supports all built-in JavaScript types out of the box and allows extension for application-specific types via user-defined plugins.

    1. const {format: prettyFormat} = require('pretty-format');
    2. const val = {object: {}};
    3. val.circularReference = val;
    4. val[Symbol('foo')] = 'foo';
    5. val.map = new Map([['prop', 'value']]);
    6. val.array = [-0, Infinity, NaN];
    7. console.log(prettyFormat(val));

    You can read more about pretty-format in the .