-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cliWrapper): wrap the cucumber CLI to keep the use of custom opt…
…ions
- Loading branch information
Showing
16 changed files
with
232 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
const { run } = require('../src/cli') | ||
|
||
run(process.argv) |
This file contains 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
7 changes: 0 additions & 7 deletions
7
examples/features/snapshot/__snapshots__/snapshot.feature.snap
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict' | ||
|
||
const arg = require('arg') | ||
const CucumberCli = require('@cucumber/cucumber/lib/cli').default | ||
|
||
const veggiesArgsDefinitions = { | ||
'--cleanSnapshots': Boolean, | ||
'--updateSnapshots': Boolean, | ||
'-u': '--updateSnapshots', | ||
'--preventSnapshotsCreation': Boolean, | ||
} | ||
|
||
const printHelp = () => { | ||
console.log('veggies help') | ||
console.log(` | ||
Options: | ||
--cleanSnapshots removes unused snapshots (not recommended while matching tags) | ||
-u, --updateSnapshots updates current snapshots if required | ||
--preventSnapshotsCreation a snapshot related step that would create one will fail instead (useful on CI environment) | ||
For more details please visit https://github.com/ekino/veggies/blob/master/README.md | ||
`) | ||
console.log('cucumber-js help\n') | ||
} | ||
|
||
exports.run = async (argv) => { | ||
const { _: cucumberArgs } = arg(veggiesArgsDefinitions, { argv, permissive: true }) | ||
|
||
try { | ||
if (cucumberArgs.includes('--help')) { | ||
printHelp() | ||
} | ||
|
||
const result = await new CucumberCli({ | ||
argv: cucumberArgs, | ||
cwd: process.cwd(), | ||
stdout: process.stdout, | ||
}).run() | ||
|
||
process.exit(result.success ? 0 : 1) | ||
} catch (error) { | ||
console.error(error) | ||
process.exit(1) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/cli/dummy_features/__snapshots__/clean_snapshots.feature.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
|
||
exports[`Should echo salut 1.1`] = `"salut | ||
"`; | ||
|
||
exports[`Should get deleted 1.1`] = `"salut | ||
"`; |
7 changes: 7 additions & 0 deletions
7
tests/cli/dummy_features/__snapshots__/update_snapshots.feature.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
|
||
exports[`Should echo salut1 1.1`] = `"salut | ||
"`; | ||
|
||
exports[`Should echo salut2 1.1`] = `"salut | ||
"`; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@cleanSnapshots | ||
Feature: Dummy test for --cleanSnapshots | ||
|
||
Scenario: Should echo salut | ||
When I run command echo salut | ||
Then exit code should be 0 | ||
And stdout output should match snapshot |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@preventSnapshotsCreation | ||
Feature: Dummy test for --preventSnapshotsCreation | ||
|
||
Scenario: Should echo salut | ||
When I run command echo salut | ||
Then exit code should be 0 | ||
And stdout output should match snapshot |
Oops, something went wrong.