From d24d2befa32d054de0bd2a9acb8806d46b70e32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o=20Soares=20dos=20Santos?= Date: Thu, 21 Apr 2022 01:17:34 +0100 Subject: [PATCH] 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 --- src/cli/cli.js | 2 +- test/unit/cli.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cli/cli.js b/src/cli/cli.js index 0f5876c..c8e29d4 100644 --- a/src/cli/cli.js +++ b/src/cli/cli.js @@ -52,7 +52,7 @@ program.command('makehtml') .option('-a, --append', 'Append data to output instead of overwriting. Ignored if writing to stdout', false) .option('-e, --extensions ', 'Load the specified extensions. Should be valid paths to node compatible extensions') .option('-p, --flavor ', 'Run with a predetermined flavor of options. Default is vanilla', 'vanilla') - .option('-c, --config ', 'Enables showdown makehtml parser config options. Overrides flavor') + .option('-c, --config ', 'Enables showdown makehtml parser config options (example: strikethrough). Overrides flavor') .option('--config-help', 'Shows configuration options for showdown parser') .action(makehtmlCommand); diff --git a/test/unit/cli.js b/test/unit/cli.js index 98ac1d0..4308c02 100644 --- a/test/unit/cli.js +++ b/test/unit/cli.js @@ -129,6 +129,16 @@ describe('showdown cli', function () { proc.stdout.should.equal('

this is a 😄

'); }); + it('should enable 2 showdown options (emoji and strikethrough)', function () { + var proc = spawnCLI('makehtml', ['-c', 'emoji', '-c', 'strikethrough'], { + input: 'this is ~~not~~ a :smile:', + encoding: 'utf-8' + }); + proc.status.should.equal(0); + proc.stderr.should.contain('Enabling option emoji'); + proc.stdout.should.equal('

this is not a 😄

'); + }); + it('should ignore unrecognized options', function () { var proc = spawnCLI('makehtml', ['-c', 'foobar'], { input: 'foo',