@@ -15,6 +15,9 @@ import {
15
15
toVsCodeArgs ,
16
16
optionDescriptions ,
17
17
options ,
18
+ Options ,
19
+ AuthType ,
20
+ OptionalString ,
18
21
} from "../../../src/node/cli"
19
22
import { shouldSpawnCliProcess } from "../../../src/node/main"
20
23
import { generatePassword , paths } from "../../../src/node/util"
@@ -787,4 +790,65 @@ describe("optionDescriptions", () => {
787
790
expect ( exists ) . toBeTruthy ( )
788
791
} )
789
792
} )
793
+ it ( "should visually align multiple options" , ( ) => {
794
+ const opts : Partial < Options < Required < UserProvidedArgs > > > = {
795
+ "cert-key" : { type : "string" , path : true , description : "Path to certificate key when using non-generated cert." } ,
796
+ "cert-host" : {
797
+ type : "string" ,
798
+ description : "Hostname to use when generating a self signed certificate." ,
799
+ } ,
800
+ "disable-update-check" : {
801
+ type : "boolean" ,
802
+ description :
803
+ "Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and \n" +
804
+ "then notifies you once every week that a new release is available." ,
805
+ } ,
806
+ }
807
+ expect ( optionDescriptions ( opts ) ) . toStrictEqual ( [
808
+ " --cert-key Path to certificate key when using non-generated cert." ,
809
+ " --cert-host Hostname to use when generating a self signed certificate." ,
810
+ ` --disable-update-check Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and
811
+ then notifies you once every week that a new release is available.` ,
812
+ ] )
813
+ } )
814
+ it ( "should add all valid options for enumerated types" , ( ) => {
815
+ const opts : Partial < Options < Required < UserProvidedArgs > > > = {
816
+ auth : { type : AuthType , description : "The type of authentication to use." } ,
817
+ }
818
+ expect ( optionDescriptions ( opts ) ) . toStrictEqual ( [ " --auth The type of authentication to use. [password, none]" ] )
819
+ } )
820
+
821
+ it ( "should show if an option is deprecated" , ( ) => {
822
+ const opts : Partial < Options < Required < UserProvidedArgs > > > = {
823
+ link : {
824
+ type : OptionalString ,
825
+ description : `
826
+ Securely bind code-server via our cloud service with the passed name. You'll get a URL like
827
+ https://hostname-username.coder.co at which you can easily access your code-server instance.
828
+ Authorization is done via GitHub.
829
+ ` ,
830
+ deprecated : true ,
831
+ } ,
832
+ }
833
+ expect ( optionDescriptions ( opts ) ) . toStrictEqual ( [
834
+ ` --link (deprecated) Securely bind code-server via our cloud service with the passed name. You'll get a URL like
835
+ https://hostname-username.coder.co at which you can easily access your code-server instance.
836
+ Authorization is done via GitHub.` ,
837
+ ] )
838
+ } )
839
+
840
+ it ( "should show newlines in description" , ( ) => {
841
+ const opts : Partial < Options < Required < UserProvidedArgs > > > = {
842
+ "install-extension" : {
843
+ type : "string[]" ,
844
+ description :
845
+ "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" +
846
+ "To install a specific version provide `@${version}`. For example: '[email protected] '." ,
847
+ } ,
848
+ }
849
+ expect ( optionDescriptions ( opts ) ) . toStrictEqual ( [
850
+ ` --install-extension Install or update a VS Code extension by id or vsix. The identifier of an extension is \`\${publisher}.\${name}\`.
851
+ To install a specific version provide \`@\${version}\`. For example: '[email protected] '.` ,
852
+ ] )
853
+ } )
790
854
} )
0 commit comments