(val: string)
| 20 | const scenariosFolder = resolve($root, 'test', 'scenarios'); |
| 21 | |
| 22 | async function getScenarioInfo(val: string) { |
| 23 | |
| 24 | // is it a name relative to the tests/scenarios folder? |
| 25 | const folder = await filepath.isFolder(val, scenariosFolder); |
| 26 | |
| 27 | if (folder) { |
| 28 | let name = basename(folder); |
| 29 | if (name === 'assets') { |
| 30 | name = basename(dirname(folder)); |
| 31 | } |
| 32 | |
| 33 | if ((await readdir(`${$root}/dist/test/scenarios/${name}/tests`).catch(returns.empty)).length === 0) { |
| 34 | // no tests in this scenario have been compiled |
| 35 | return undefined; |
| 36 | } |
| 37 | const assets = await filepath.isFolder('assets', folder) ?? folder; |
| 38 | |
| 39 | return { |
| 40 | name, |
| 41 | assets, |
| 42 | workspace: (await glob(`${folder}/**/*.code-workspace`))[0] || assets |
| 43 | }; |
| 44 | } |
| 45 | |
| 46 | const file = await filepath.isFile(val, scenariosFolder); |
| 47 | if (file) { |
| 48 | const assets = dirname(dirname(file)); |
| 49 | const name = basename(assets); |
| 50 | if ((await readdir(`${$root}/dist/test/scenarios/${name}/tests`)).length === 0) { |
| 51 | // no tests in this scenario have been compiled |
| 52 | return undefined; |
| 53 | } |
| 54 | |
| 55 | return { |
| 56 | name, |
| 57 | assets, |
| 58 | workspace: file |
| 59 | }; |
| 60 | } |
| 61 | return undefined; |
| 62 | } |
| 63 | |
| 64 | export async function getTestInfo(...scenarioOptions: (string | undefined)[]) { |
| 65 | for (const each of scenarioOptions) { |
no test coverage detected