Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active June 27, 2018 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/220cffabcbd567b7039259b6066d1e3b to your computer and use it in GitHub Desktop.
Save Shelob9/220cffabcbd567b7039259b6066d1e3b to your computer and use it in GitHub Desktop.
{
"presets": [ "@wordpress/default" ]
}
{
"jest": {
"collectCoverageFrom": [
"clients/**/*.js"
],
"coverageThreshold": {
"global": {
"statements": 90,
"branches": 90,
"functions": 90,
"lines": 90
}
},
"automock": false,
"setupFiles": [
"./clients/tests/setupJest.js"
]
}
}
global.wp = {
shortcode: {
},
apiRequest: {
}
};
Object.defineProperty( global.wp, 'element', {
get: () => require( 'React' ),
} );
// Define WordPress dependencies
const wpDependencies = [ 'components', 'element', 'blocks', 'utils', 'date' ];
// Setup externals for all WordPress dependencies
wpDependencies.forEach( wpDependency => {
externals[ '@wordpress/' + wpDependency ] = {
this: [ 'wp', wpDependency ]
};
});
import React from 'react';
Object.defineProperty( global.wp, 'element', {
get: () => React
} );
//The rest of the code...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment