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 are already have another preset in your configuration, you can merge them together:
const merge = require("merge");
const tsPreset = require("ts-jest/jest-preset");
const cloudscapePreset = require("@cloudscape-design/jest-preset");
module.exports = merge.recursive(tsPreset, cloudscapePreset, {
});
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 @cloudscape-design/components
module remains
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.
- Check if you have
transformIgnorePatterns
defined in your custom configuration. If so, it requires a manual merge with configuration defined in the preset. - 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.