|
Download wp-calypso/packages/calypso-jest/README.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 993 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-jest/README.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/calypso-jest/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-jest/README.md
993 Bytes
@automattic/calypso-jest
This package provides a Jest preset used to run tests in Calypso. In your jest.config.js set the following:
module.exports = {
preset: '@automattic/calypso-jest',
};
Major features:
- Find tests under
<rootDir>insidetestfolder. Valid extensions are.ts,.js,.tsx,.jsx - Can use
calypso:srcfrompackage.jsonto resolve a package - Can use conditional exports
Assets transformer
Jest would fail when trying to import asset files that it cannot parse, i.e. they're not plain JavaScript:
const MyFlag = ( { countryCode } ) => (
<img alt="" src={ require( `flags/${ countryCode }.svg` ).default } />
);
This packages includes a transfomer that be used to transform all those imports to a module that returns the asset file's basename as a string:
const config = {
transform: {
'\\.(gif|jpg|jpeg|png|svg|scss|sass|css)$': require.resolve(
'@automattic/calypso-jest/asset-transform.js'
),
},
};