Skip to content

Commit

Permalink
fix: respect spec cmd line arg
Browse files Browse the repository at this point in the history
  • Loading branch information
vobu committed Oct 21, 2023
1 parent 7408159 commit 0d0d4ef
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let configPath = "./webapp/test/e2e/"
let fullConfigPath: string
let BASE_URL = "http://localhost:8080/index.html"
let SPECS: string
let relativeTestDir: string
let relativeTestDir = "./webapp/test/e2e/"
let absoluteTestDir: string
let ts = false // whether we're working in TS land

Expand All @@ -32,6 +32,7 @@ export async function run() {

ts = process.argv.find((arg) => arg.includes("ts")) ? true : false

// respect --configPath cmd line arg
if (process.argv.find((arg) => arg.includes("configPath"))) {
const index = process.argv.findIndex((arg) => arg.includes("configPath")) + 1
configPath = process.argv[index]
Expand All @@ -48,7 +49,13 @@ export async function run() {
await fs.mkdir(fullConfigPath, { recursive: true })
}

relativeTestDir = ts ? "./webapp/test/e2e" : "./webapp/test/e2e"
// respect --specs cmd line arg
if (process.argv.find((arg) => arg.includes("specs"))) {
const index = process.argv.findIndex((arg) => arg.includes("specs")) + 1
relativeTestDir = process.argv[index]
relativeTestDir = relativeTestDir.endsWith(path.sep) ? relativeTestDir : relativeTestDir + path.sep
}

absoluteTestDir = path.resolve(process.cwd(), relativeTestDir)
const testDirExists = await fs.access(absoluteTestDir).then(
() => true,
Expand Down

0 comments on commit 0d0d4ef

Please sign in to comment.