-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add yarn test-bundles and yarn test-prod-bundles
Only files ending with -test.public.js are opted in (so far we don't have any).
- Loading branch information
Showing
5 changed files
with
56 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
modulePathIgnorePatterns: [ | ||
'<rootDir>/scripts/rollup/shims/', | ||
'<rootDir>/scripts/bench/', | ||
], | ||
transform: { | ||
'.*': require.resolve('./preprocessor.js'), | ||
}, | ||
setupFiles: [require.resolve('./setupEnvironment.js')], | ||
setupTestFrameworkScriptFile: require.resolve('./setupTests.js'), | ||
testRegex: '/__tests__/.*(\\.js|\\.coffee|[^d]\\.ts)$', | ||
moduleFileExtensions: ['js', 'json', 'node', 'coffee', 'ts'], | ||
rootDir: process.cwd(), | ||
roots: ['<rootDir>/packages', '<rootDir>/scripts'], | ||
collectCoverageFrom: ['packages/**/*.js'], | ||
timers: 'fake', | ||
}; |
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,32 @@ | ||
'use strict'; | ||
|
||
const {readdirSync, statSync} = require('fs'); | ||
const {join} = require('path'); | ||
|
||
// Create a module map to point React packages to the build output. | ||
const baseConfig = require('./config.base'); | ||
const packagesRoot = join(__dirname, '..', '..', 'packages'); | ||
const packages = readdirSync(packagesRoot).filter(dir => { | ||
if (dir.charAt(0) === '.') { | ||
return false; | ||
} | ||
const packagePath = join(packagesRoot, dir, 'package.json'); | ||
return statSync(packagePath).isFile(); | ||
}); | ||
const moduleNameMapper = {}; | ||
packages.forEach(name => { | ||
// Root entry point | ||
moduleNameMapper[`^${name}$`] = `<rootDir>/build/packages/${name}`; | ||
// Named entry points | ||
moduleNameMapper[`^${name}/(.*)$`] = `<rootDir>/build/packages/${name}/$1`; | ||
}); | ||
|
||
module.exports = Object.assign({}, baseConfig, { | ||
// Redirect imports to the compiled bundles. | ||
moduleNameMapper, | ||
// Only run bundle tests on whitelisted .public.* files. | ||
// TODO: switch to a blacklist instead when enough tests are opted in. | ||
testRegex: '/__tests__/.*\\.public\\.js$', | ||
// Exclude the build output from transforms. | ||
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'], | ||
}); |
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,19 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
modulePathIgnorePatterns: [ | ||
'<rootDir>/scripts/rollup/shims/', | ||
'<rootDir>/scripts/bench/', | ||
], | ||
transform: { | ||
'.*': require.resolve('./preprocessor.js'), | ||
}, | ||
setupFiles: [require.resolve('./setupEnvironment.js')], | ||
setupTestFrameworkScriptFile: require.resolve('./setupTests.js'), | ||
testRegex: '/__tests__/.*(\\.js|\\.coffee|[^d]\\.ts)$', | ||
moduleFileExtensions: ['js', 'json', 'node', 'coffee', 'ts'], | ||
rootDir: process.cwd(), | ||
roots: ['<rootDir>/packages', '<rootDir>/scripts'], | ||
collectCoverageFrom: ['packages/**/*.js'], | ||
timers: 'fake', | ||
}; | ||
const baseConfig = require('./config.base'); | ||
|
||
module.exports = Object.assign({}, baseConfig); |
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