Skip to content

Commit

Permalink
Clean up Jest initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed Jul 8, 2017
1 parent 0b79caf commit 140ae60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions test/setup-test-framework.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// `babel-jest` should be doing this instead, but apparently it's not working.
require( 'core-js/modules/es7.object.values' );

// Chai plugins
Expand Down
18 changes: 7 additions & 11 deletions test/setup-wp-aliases.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
const lazySetupAlias = object =>
name =>
Object.defineProperty( object, name, {
get: () => require( name ),
} );
const lazySetupWpAlias = lazySetupAlias( global.wp );

const entryPointNames = [
// Set up `wp.*` aliases. Handled by Webpack outside of the test build.
[
'element',
'i18n',
'components',
'utils',
'blocks',
'date',
'editor',
];

entryPointNames.forEach( lazySetupWpAlias );
].forEach( entryPointName => {
Object.defineProperty( global.wp, entryPointName, {
get: () => require( entryPointName ),
} );
} );

0 comments on commit 140ae60

Please sign in to comment.