Skip to content

Commit

Permalink
fix(runner): it should fail if not features are found
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Sep 20, 2022
1 parent eeaa6d5 commit 17e5623
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions runner/runSuite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,22 @@ describe('runSuite()', () => {
assert.deepEqual(result.summary.skipped, 1)
assert.deepEqual(result.summary.total, 2)
})

it('should fail if the suite has not features', async () => {
const runner = runSuite(
await parseFeaturesInFolder(
path.join(
process.cwd(),
'runner',
'test-data',
'runSuite',
'no-features',
),
),
'Example',
)

const result = await runner.run()
assert.equal(result.ok, false)
})
})
14 changes: 14 additions & 0 deletions runner/runSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ export const runSuite = <Context extends Record<string, any>>(
return runner
},
run: async (context?: Context) => {
if (featureFiles.length === 0)
return {
ok: false,
results: [],
summary: {
duration: 0,
failed: 0,
passed: 0,
skipped: 0,
total: 0,
},
name,
}

const featureResults: [ParsedPath, FeatureResult][] = []
const featureNameResultMap: Record<string, boolean> = {}

Expand Down
Empty file.

0 comments on commit 17e5623

Please sign in to comment.