|
1 | 1 | import * as path from "path" |
2 | 2 |
|
| 3 | +import yargs from "yargs" |
| 4 | +import { hideBin } from "yargs/helpers" |
3 | 5 | import { runTests } from "@vscode/test-electron" |
4 | 6 |
|
5 | 7 | async function main() { |
| 8 | + const argv = await yargs(hideBin(process.argv)) |
| 9 | + .option("exercise", { |
| 10 | + alias: "e", |
| 11 | + type: "string", |
| 12 | + description: "Path to the exercise directory", |
| 13 | + required: true, |
| 14 | + }) |
| 15 | + .help().argv |
| 16 | + |
6 | 17 | const extensionDevelopmentPath = path.resolve(__dirname, "../../../") |
7 | 18 | const extensionTestsPath = path.resolve(__dirname, "./runExercise") |
| 19 | + const testWorkspace = path.resolve(__dirname, "..", argv.exercise) |
8 | 20 |
|
9 | 21 | await runTests({ |
10 | 22 | extensionDevelopmentPath: extensionDevelopmentPath, |
11 | 23 | extensionTestsPath: extensionTestsPath, |
12 | | - launchArgs: ["foo", "bar", "baz"], |
| 24 | + launchArgs: [testWorkspace, "--disable-extensions"], |
| 25 | + extensionTestsEnv: { |
| 26 | + prompt: ` |
| 27 | + Your job is to complete a coding exercise described by \`.docs/instructions.md\`. |
| 28 | + A file with the implementation stubbed out has been created for you, along with a test file. |
| 29 | + To successfully complete the exercise, you must pass all the tests in the test file. |
| 30 | + To confirm that your solution is correct, run the tests with \`yarn test\`. |
| 31 | + Before running the test make sure your environment is set up by running \`corepack enable\` to enable yarn and \`yarn install\` to install the dependencies. |
| 32 | + ` |
| 33 | + .trim() |
| 34 | + .split("\n") |
| 35 | + .map((line) => line.trim()) |
| 36 | + .join("\n"), |
| 37 | + }, |
13 | 38 | }) |
14 | 39 | } |
15 | 40 |
|
|
0 commit comments