Created
August 21, 2023 16:11
-
-
Save johnnieskywalker/94dc79d0e52d233128659e6e013748e5 to your computer and use it in GitHub Desktop.
k6init.js, to run `node k6init.js `
This file contains hidden or 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
| const fs = require('fs'); | |
| const path = require('path'); | |
| const directories = [ | |
| 'tests', | |
| 'modules', | |
| 'data' | |
| ]; | |
| console.log(`Initializing new K6 project structure in the current directory.`); | |
| directories.forEach(dir => { | |
| if (!fs.existsSync(dir)) { | |
| fs.mkdirSync(dir); | |
| } | |
| }); | |
| const readmeContent = `# K6 Project | |
| This is a K6 test project. | |
| ## How to run tests | |
| To run a test, use: | |
| \`\`\` | |
| k6 run tests/yourTestFile.js | |
| \`\`\` | |
| `; | |
| if (!fs.existsSync('README.md')) { | |
| fs.writeFileSync('README.md', readmeContent); | |
| } | |
| console.log('K6 project initialization in the current directory is complete!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment