Download react-instantsearch/scripts/test-examples.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 731 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/scripts/test-examples.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/scripts/test-examples.js
-
curl -L -o test-examples.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/scripts/test-examples.js
731 Bytes
| 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', | |
| } | |
| ); | |
| }); | |