File size: 731 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
const path = require('path');
const glob = require('glob');
const execSync = require('child_process').execSync;
const fs = require('fs');
const examples = glob
.sync(path.join(__dirname, '..', 'examples', '!(react-native*)'))
.map((examplePath) => {
const pkg = JSON.parse(
fs.readFileSync(path.join(examplePath, 'package.json'))
);
return {
path: examplePath,
shouldRunTest: Boolean(pkg.scripts && pkg.scripts.test),
};
});
examples
.filter((example) => example.shouldRunTest)
.map((example) => example.path)
.forEach((example) => {
execSync(
`cd ${example} && echo Testing $(basename $(pwd)) example && yarn test`,
{
stdio: 'inherit',
}
);
});
|