@@ -119,18 +119,18 @@ describe("@lingui/conf", function () {
119119 } )
120120 } )
121121
122- it ( "searches for a config file" , function ( ) {
123- // hide validation warning about missing locales
124- mockConsole ( ( ) => {
125- const config = getConfig ( {
126- cwd : path . resolve ( __dirname , path . join ( "fixtures" , "valid" ) ) ,
122+ describe ( "config file" , function ( ) {
123+ it ( "searches for a .linguirc config file" , function ( ) {
124+ // hide validation warning about missing locales
125+ mockConsole ( ( ) => {
126+ const config = getConfig ( {
127+ cwd : path . resolve ( __dirname , path . join ( "fixtures" , "valid" ) ) ,
128+ } )
129+ expect ( config . locales ) . toEqual ( [ "en-gb" ] )
127130 } )
128- expect ( config . locales ) . toEqual ( [ "en-gb" ] )
129131 } )
130- } )
131132
132- describe ( "with configPath parameter" , function ( ) {
133- it ( "allows specific config file to be loaded" , function ( ) {
133+ it ( "allows specific config file to be loaded with configPath parameter" , function ( ) {
134134 // hide validation warning about missing locales
135135 mockConsole ( ( ) => {
136136 const config = getConfig ( {
@@ -142,39 +142,52 @@ describe("@lingui/conf", function () {
142142 expect ( config . locales ) . toEqual ( [ "cs" , "sk" ] )
143143 } )
144144 } )
145- } )
146-
147- describe ( "fallbackLocales logic" , ( ) => {
148- afterEach ( ( ) => {
149- mockFs . restore ( )
150- } )
151145
152- it ( "if fallbackLocale is defined, we use the default one on fallbackLocales" , ( ) => {
153- mockFs ( {
154- ".linguirc" : JSON . stringify ( {
155- locales : [ "en-US" ] ,
156- fallbackLocale : "en"
157- } )
158- } )
159- mockConsole ( ( console ) => {
146+ it ( "loads TypeScript config" , function ( ) {
147+ // hide validation warning about missing locales
148+ mockConsole ( ( ) => {
160149 const config = getConfig ( {
161- configPath : ".linguirc" ,
150+ configPath : path . resolve (
151+ __dirname ,
152+ path . join ( "fixtures" , "valid" , "custom.config.ts" )
153+ ) ,
162154 } )
163- expect ( config . fallbackLocales . default ) . toEqual ( "en" )
164- expect ( getConsoleMockCalls ( console . warn ) ) . toMatchSnapshot ( )
155+ expect ( config . locales ) . toEqual ( [ "pl" ] )
165156 } )
166157 } )
167158
168- it ( "if fallbackLocales default is defined, we dont build the cldr" , ( ) => {
169- const config = getConfig ( {
170- configPath : path . resolve (
171- __dirname ,
172- path . join ( "fixtures" , "valid" , ".fallbacklocalesrc" )
173- ) ,
159+ describe ( "fallbackLocales logic" , ( ) => {
160+ afterEach ( ( ) => {
161+ mockFs . restore ( )
162+ } )
163+
164+ it ( "if fallbackLocale is defined, we use the default one on fallbackLocales" , ( ) => {
165+ mockFs ( {
166+ ".linguirc" : JSON . stringify ( {
167+ locales : [ "en-US" ] ,
168+ fallbackLocale : "en" ,
169+ } ) ,
170+ } )
171+ mockConsole ( ( console ) => {
172+ const config = getConfig ( {
173+ configPath : ".linguirc" ,
174+ } )
175+ expect ( config . fallbackLocales . default ) . toEqual ( "en" )
176+ expect ( getConsoleMockCalls ( console . warn ) ) . toMatchSnapshot ( )
177+ } )
174178 } )
175- expect ( config . fallbackLocales ) . toEqual ( {
176- "en-US" : [ "en" ] ,
177- default : "en" ,
179+
180+ it ( "if fallbackLocales default is defined, we dont build the cldr" , ( ) => {
181+ const config = getConfig ( {
182+ configPath : path . resolve (
183+ __dirname ,
184+ path . join ( "fixtures" , "valid" , ".fallbacklocalesrc" )
185+ ) ,
186+ } )
187+ expect ( config . fallbackLocales ) . toEqual ( {
188+ "en-US" : [ "en" ] ,
189+ default : "en" ,
190+ } )
178191 } )
179192 } )
180193 } )
0 commit comments