@@ -69,29 +69,30 @@ const base = getConverter2Base();
6969const app = getConverter2App ( ) ;
7070const program = getConverter2Program ( ) ;
7171
72- function convert ( entry : string ) {
73- const entryPoint = [
74- join ( base , `behavior/${ entry } .ts` ) ,
75- join ( base , `behavior/${ entry } .d.ts` ) ,
76- join ( base , `behavior/${ entry } .tsx` ) ,
77- join ( base , `behavior/${ entry } .js` ) ,
78- join ( base , "behavior" , entry , "index.ts" ) ,
79- join ( base , "behavior" , entry , "index.js" ) ,
80- ] . find ( existsSync ) ;
81-
82- ok ( entryPoint , `No entry point found for ${ entry } ` ) ;
83- const sourceFile = program . getSourceFile ( entryPoint ) ;
84- ok ( sourceFile , `No source file found for ${ entryPoint } ` ) ;
85-
86- app . options . setValue ( "entryPoints" , [ entryPoint ] ) ;
72+ function convert ( ...entries : [ string , ...string [ ] ] ) {
73+ const entryPoints = entries . map ( ( entry ) => {
74+ const entryPoint = [
75+ join ( base , `behavior/${ entry } .ts` ) ,
76+ join ( base , `behavior/${ entry } .d.ts` ) ,
77+ join ( base , `behavior/${ entry } .tsx` ) ,
78+ join ( base , `behavior/${ entry } .js` ) ,
79+ join ( base , "behavior" , entry , "index.ts" ) ,
80+ join ( base , "behavior" , entry , "index.js" ) ,
81+ ] . find ( existsSync ) ;
82+
83+ ok ( entryPoint , `No entry point found for ${ entry } ` ) ;
84+ const sourceFile = program . getSourceFile ( entryPoint ) ;
85+ ok ( sourceFile , `No source file found for ${ entryPoint } ` ) ;
86+
87+ return { displayName : entry , program, sourceFile, entryPoint } ;
88+ } ) ;
89+
90+ app . options . setValue (
91+ "entryPoints" ,
92+ entryPoints . map ( ( e ) => e . entryPoint ) ,
93+ ) ;
8794 clearCommentCache ( ) ;
88- return app . converter . convert ( [
89- {
90- displayName : entry ,
91- program,
92- sourceFile,
93- } ,
94- ] ) ;
95+ return app . converter . convert ( entryPoints ) ;
9596}
9697
9798describe ( "Behavior Tests" , ( ) => {
@@ -953,4 +954,20 @@ describe("Behavior Tests", () => {
953954 "With Spaces" ,
954955 ] ) ;
955956 } ) ;
957+
958+ it ( "Supports disabling sorting of entry points #2393" , ( ) => {
959+ app . options . setValue ( "sort" , [ "alphabetical" ] ) ;
960+ const project = convert ( "blockComment" , "asConstEnum" ) ;
961+ equal ( project . children ?. map ( ( c ) => c . name ) , [
962+ "asConstEnum" ,
963+ "blockComment" ,
964+ ] ) ;
965+
966+ app . options . setValue ( "sortEntryPoints" , false ) ;
967+ const project2 = convert ( "blockComment" , "asConstEnum" ) ;
968+ equal ( project2 . children ?. map ( ( c ) => c . name ) , [
969+ "blockComment" ,
970+ "asConstEnum" ,
971+ ] ) ;
972+ } ) ;
956973} ) ;
0 commit comments