@cloudscape-design/jest-preset

中文文档
2.0.64发布于 2026/09/14Apache-2.0CommonJS近 30 天下载 4.9万

This package contains Jest presets used to test an application based on the Cloudscape Design System React components.

原始使用文档
文档目录7 节
  1. Jest presets for Cloudscape Design System
  2. Getting help
  3. Getting started
  4. Advanced usage
  5. Troubleshooting
  6. Contributing
  7. License

Jest presets for Cloudscape Design System

This package contains Jest presets used to test an application based on the Cloudscape Design System React components.

Cloudscape is an open source design system for building intuitive, engaging, and inclusive web cloud experiences at scale. It consists of an extensive set of guidelines to create user experiences, along with the design resources and front-end components to streamline implementation.

Cloudscape was built for and is used by Amazon Web Services (AWS) products and services. We created it in 2016 to improve the user experience across AWS web applications, and also to help teams implement those applications faster. Since then, we have continued enhancing the system based on customer feedback and research.

You can find documentation about testing in the Cloudscape documentation website.

Browse the components repository of Cloudscape Design System.

Getting help

You can create bug reports or feature requests, or start a discussion to ask a question. To minimize duplicates, we recommend that you search for existing bug reports, feature requests, or discussions before initiating a new thread.

Getting started

Install this package with the npm package manager of your choice, for example npm install --save-dev @cloudscape-design/jest-preset.

Make sure that you also have babel-jest installed.

And package.json along with its peer dependency babel-jest of the same version as the jest you are using:

"devDependencies": {
    "@cloudscape-design/jest-preset": "^2.0.0",
    "babel-jest": "{your jest version}"
}

In your jest.config.json:

{
  "preset": "@cloudscape-design/jest-preset"
}

Advanced usage

If you already have another preset in your configuration, you can use @cloudscape-design/jest-preset/merge helper to merge them together:

const mergePresets = require('@cloudscape-design/jest-preset/merge');
const tsPreset = require('ts-jest/jest-preset');
const cloudscapePreset = require('@cloudscape-design/jest-preset');

module.exports = mergePresets(tsPreset, cloudscapePreset, {
  // ... your config
});

Note that if multiple presets provide transformIgnorePatterns property, you need to merge it manually. By default, merge operation extends the ignore paths, you need to make sure that the modules defined in jest-preset.js remain unignored.

Troubleshooting

I added preset, but still seeing "Jest encountered an unexpected token" issue

It means that Jest preset could not apply the configuration properly.

  1. Check if you have transformIgnorePatterns defined in your custom configuration. If so, it requires a manual merge with configuration defined in jest-preset.js.
  2. Check if you are overwriting transform property. It should merge the new paths in, not replace. Check the "Advanced usage" section above for an example.

Contributing

The contribution guidelines contains information on how to contribute, as well as our support model and versioning strategy.

License

This project is licensed under the Apache 2.0 License.

版本与发布记录

@cloudscape-design/jest-preset 共发布 65 个版本,首次发布于 2022/07/18;过去 12 个月发布了 17 个版本。

版本发布日期距今
2.0.64latest2026/09/141 个月前
2.0.632026/09/072 个月前
2.0.622026/08/142 个月前
2.0.612026/08/112 个月前
2.0.602026/07/283 个月前
2.0.592026/07/133 个月前

关于 @cloudscape-design/jest-preset 的常见问题

@cloudscape-design/jest-preset 是什么?

This package contains Jest presets used to test an application based on the Cloudscape Design System React components.

如何安装 @cloudscape-design/jest-preset?

在项目目录运行 npm install @cloudscape-design/jest-preset,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:jest(>=24)、babel-jest(>=24)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cloudscape-design/jest-preset 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cloudscape-design__jest-preset 是否存在。

@cloudscape-design/jest-preset 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cloudscape-design/jest-preset 可以商用吗?

@cloudscape-design/jest-preset 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@cloudscape-design/jest-preset 的下载量有多少?

根据 npm 官方下载统计,@cloudscape-design/jest-preset 在 2026/10/10 – 2026/11/08 这 30 天内被下载 49,285 次,日均约 1,643 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cloudscape-design/jest-preset 还在维护吗?

最新版本 2.0.64 发布于 2026/09/14(1 个月前);至今共发布 65 个版本,其中过去 12 个月发布了 17 个;首次发布于 2022/07/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。