Skip to content

Commit 914129f

Browse files
committed
test(cli)!: Add test for multiple config options
Note: there was a breaking change that we forgot to document. Ww write the breaking change here for it to be picked up in the future 3.0 release, even though it was introduced in commit 3871765 BREAKING CHANGE: the CLI no longer accepts "extra options". Instead you should pass the `-c` flag. To update: before: ``` showdown makehtml -i foo.md -o bar.html --strikethrough --emoji ``` after: ``` showdown makehtml -i foo.md -o bar.html -c strikethrough -c emoji ``` Closes #916
1 parent 8b48882 commit 914129f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/cli/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ program.command('makehtml')
5252
.option('-a, --append', 'Append data to output instead of overwriting. Ignored if writing to stdout', false)
5353
.option('-e, --extensions <extensions...>', 'Load the specified extensions. Should be valid paths to node compatible extensions')
5454
.option('-p, --flavor <flavor>', 'Run with a predetermined flavor of options. Default is vanilla', 'vanilla')
55-
.option('-c, --config <config...>', 'Enables showdown makehtml parser config options. Overrides flavor')
55+
.option('-c, --config <config...>', 'Enables showdown makehtml parser config options (example: strikethrough). Overrides flavor')
5656
.option('--config-help', 'Shows configuration options for showdown parser')
5757
.action(makehtmlCommand);
5858

test/node/testsuite.cli.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ describe('showdown cli', function () {
128128
proc.stdout.should.equal('<p>this is a 😄</p>');
129129
});
130130

131+
it('should enable 2 showdown options (emoji and strikethrough)', function () {
132+
var proc = spawnCLI('makehtml', ['-c', 'emoji', '-c', 'strikethrough'], {
133+
input: 'this is ~~not~~ a :smile:',
134+
encoding: 'utf-8'
135+
});
136+
proc.status.should.equal(0);
137+
proc.stderr.should.contain('Enabling option emoji');
138+
proc.stdout.should.equal('<p>this is <del>not</del> a 😄</p>');
139+
});
140+
131141
it('should ignore unrecognized options', function () {
132142
var proc = spawnCLI('makehtml', ['-c', 'foobar'], {
133143
input: 'foo',

0 commit comments

Comments
 (0)