Skip to content

Commit

Permalink
[test] Conditional tests (#12191)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jul 18, 2018
1 parent 77a2d77 commit 77c48ca
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 35 deletions.
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,37 @@ jobs:
- run:
name: Coverage
command: bash <(curl -s https://codecov.io/bash)
test_material-ui-x:
<<: *defaults
steps:
- *restore_repo
- run:
name: material-ui-icons
command: |
if [[ ((`git diff --raw master | grep packages/material-ui-icons` > 0))]]; then
echo "changes, let's run the tests"
cd packages/material-ui-icons && yarn test
else
echo "no changes "
fi
- run:
name: material-ui-codemod
command: |
if [[ ((`git diff --raw master | grep packages/material-ui-codemod` > 0))]]; then
echo "changes, let's run the tests"
cd packages/material-ui-codemod && yarn test
else
echo "no changes "
fi
- run:
name: eslint-plugin-material-ui
command: |
if [[ ((`git diff --raw master | grep packages/eslint-plugin-material-ui` > 0))]]; then
echo "changes, let's run the tests"
cd packages/eslint-plugin-material-ui && yarn test
else
echo "no changes "
fi
test_build:
<<: *defaults
# This isn't user facing code.
Expand Down Expand Up @@ -118,6 +149,9 @@ workflows:
- test_unit:
requires:
- checkout
- test_material-ui-x:
requires:
- checkout
- test_browser:
requires:
- checkout
Expand All @@ -126,6 +160,7 @@ workflows:
- checkout
- test_regressions:
requires:
- test_material-ui-x
- test_unit
- test_browser
- test_build
48 changes: 17 additions & 31 deletions docs/src/pages/style/icons/SvgMaterialIconsAll.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
// import React from 'react';

const requireIcons = require.context('../../../../../packages/material-ui-icons/src', true, /js$/);
// const requireIcons = require.context(
// '../../../../../packages/material-ui-icons/src', true, /js$/);

const styles = theme => ({
root: {
color: theme.palette.text.primary,
maxHeight: 300,
overflow: 'auto',
},
});
// function SvgMaterialIconsAll() {
// return (
// <div>
// {requireIcons.keys().map(key => {
// if (key === './index.js' || key === './utils/createSvgIcon.js') {
// return null;
// }

function SvgMaterialIconsAll(props) {
const { classes } = props;
return (
<div className={classes.root}>
{requireIcons.keys().map(key => {
if (key === './index.js' || key === './utils/createSvgIcon.js') {
return null;
}
// const Icon = requireIcons(key).default;
// return <Icon key={key} />;
// })}
// </div>
// );
// }

const Icon = requireIcons(key).default;
return <Icon key={key} />;
})}
</div>
);
}

SvgMaterialIconsAll.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(SvgMaterialIconsAll);
// export default withStyles(styles)(SvgMaterialIconsAll);
13 changes: 9 additions & 4 deletions test/regressions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ const blacklistSuite = [

// Useless
'docs-', // Home
'docs-versions',
'docs-discover-more-showcase',
'docs-guides',
'docs-premium-themes',
'docs-discover-more-showcase',
'docs-style-color', // non important demo
'docs-versions',
];

const blacklistFilename = [
'docs-getting-started-usage/Usage.png', // codesandbox iframe
'docs-demos-drawers/tileData.png', // no component
'docs-demos-grid-list/tileData.png', // no component
'docs-getting-started-usage/Usage.png', // codesandbox iframe
];

// Also use some of the demos to avoid code duplication.
Expand Down Expand Up @@ -104,8 +104,13 @@ tests.forEach(test => {
suite = vrtest.createSuite(test.suite);
}

const TestCase = test.case;

if (!TestCase) {
return;
}

suite.createTest(test.name, () => {
const TestCase = test.case;
ReactDOM.render(
<TestViewer>
<TestCase />
Expand Down

0 comments on commit 77c48ca

Please sign in to comment.