-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Setup Jest as an alternative test runner (#1382)
- Loading branch information
Showing
14 changed files
with
129 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules | ||
build | ||
coverage | ||
gutenberg.pot | ||
.vscode | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const pegjs = require( 'pegjs' ); | ||
|
||
module.exports = { | ||
process( src ) { | ||
// Description of PEG.js options: https://github.com/pegjs/pegjs#javascript-api | ||
const pegOptions = { | ||
output: 'source', | ||
cache: false, | ||
optimize: 'speed', | ||
trace: false, | ||
}; | ||
const methodName = ( typeof pegjs.generate === 'function' ) ? 'generate' : 'buildParser'; | ||
|
||
return `module.exports = ${ pegjs[ methodName ]( src, pegOptions ) };`; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require( 'core-js/modules/es7.object.values' ); | ||
|
||
// Chai plugins | ||
require( 'chai' ) | ||
.use( require( 'dirty-chai' ) ) | ||
.use( require( 'sinon-chai' ) ); | ||
|
||
// Sinon plugins | ||
const sinon = require( 'sinon' ); | ||
const sinonTest = require( 'sinon-test' ); | ||
sinon.test = sinonTest.configureTest( sinon ); | ||
sinon.testCase = sinonTest.configureTestCase( sinon ); | ||
|
||
// Make sure we can share test helpers between Mocha and Jest | ||
global.after = global.afterAll; | ||
global.before = global.beforeAll; | ||
global.context = global.describe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const lazySetupAlias = object => | ||
name => | ||
Object.defineProperty( object, name, { | ||
get: () => require( name ), | ||
} ); | ||
const lazySetupWpAlias = lazySetupAlias( global.wp ); | ||
|
||
const entryPointNames = [ | ||
'element', | ||
'i18n', | ||
'components', | ||
'utils', | ||
'blocks', | ||
'date', | ||
'editor', | ||
]; | ||
|
||
entryPointNames.forEach( lazySetupWpAlias ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters