-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wil Wilsman
committed
Oct 3, 2018
1 parent
89de181
commit de7fc4d
Showing
11 changed files
with
106 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const webpack = require('webpack'); | ||
|
||
const miragePlugin = { | ||
// Standard yargs options object | ||
options: { | ||
'mirage [scenario]': { | ||
describe: 'Enable Mirage Server and specify a scenario', | ||
type: 'string', | ||
group: 'Mirage Server' | ||
}, | ||
}, | ||
|
||
// Stripes CLI hook into "webpackOverrides" | ||
beforeBuild: (options) => { | ||
const mirageOption = options.mirage === true ? 'default' : options.mirage; | ||
|
||
return (config) => { | ||
config.plugins.push(new webpack.EnvironmentPlugin({ | ||
MIRAGE_SCENARIO: mirageOption || 'default' | ||
})); | ||
|
||
if (!!mirageOption) { | ||
console.info('Using Mirage Server'); // eslint-disable-line no-console | ||
|
||
return Object.assign({}, config, { | ||
entry: ['./tests/network/boot'].concat(config.entry) | ||
}); | ||
} else { | ||
return config; | ||
} | ||
}; | ||
} | ||
} | ||
|
||
module.exports = { | ||
hasAllPerms: true, | ||
|
||
aliases: { | ||
'@folio/stripes-smart-components': '.' | ||
}, | ||
|
||
// Custom command extension | ||
plugins: { | ||
serve: miragePlugin | ||
} | ||
}; |
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,9 @@ | ||
require('babel-polyfill'); | ||
|
||
// require all test files matching 'lib/**/tests/*-test' | ||
const requireTest = require.context('../lib/', true, /(.*?)\/tests\/(.*?)-test/); | ||
requireTest.keys().forEach(requireTest); | ||
|
||
// require all source files in lib for code coverage | ||
const componentsContext = require.context('../lib/', true, /^(?!.*(stories|examples)).*\.js$/); | ||
componentsContext.keys().forEach(componentsContext); |
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,9 @@ | ||
import startMirage from '@folio/stripes-core/test/bigtest/network/start'; | ||
import mirageOptions from '.'; | ||
|
||
/** | ||
* Start mirage to handle requests in development and production. Note | ||
* that this file will _not_ be include in the build at all if mirage | ||
* is disabled. Also, it will not included in test builds. | ||
*/ | ||
window.mirage = startMirage(process.env.MIRAGE_SCENARIO, mirageOptions); |
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,3 @@ | ||
// typical mirage config export | ||
export default function configure() { | ||
} |
Empty file.
Empty file.
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,28 @@ | ||
import { camelize } from '@bigtest/mirage'; | ||
|
||
// auto-import all mirage submodules | ||
const req = require.context('./', true, /\.js$/); | ||
const modules = req.keys().reduce((acc, modulePath) => { | ||
const moduleParts = modulePath.split('/'); | ||
const moduleType = moduleParts[1]; | ||
const moduleName = moduleParts[2]; | ||
|
||
if (moduleName) { | ||
const moduleKey = camelize(moduleName.replace('.js', '')); | ||
|
||
return Object.assign(acc, { | ||
[moduleType]: { | ||
...(acc[moduleType] || {}), | ||
[moduleKey]: req(modulePath).default | ||
} | ||
}); | ||
} else if (modulePath === './config.js') { | ||
return Object.assign(acc, { | ||
baseConfig: req(modulePath).default | ||
}); | ||
} else { | ||
return acc; | ||
} | ||
}, {}); | ||
|
||
export default modules; |
Empty file.
Empty file.
Empty file.