File tree Expand file tree Collapse file tree 3 files changed +49
-15
lines changed Expand file tree Collapse file tree 3 files changed +49
-15
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,23 @@ exports[`Catalog POT Flow Should get translations from template if locale file n
19
19
}
20
20
` ;
21
21
22
+ exports [` Catalog collect should extract files with special characters in the include path 1` ] = `
23
+ {
24
+ Component D : {
25
+ comments: [],
26
+ context: undefined ,
27
+ message: undefined ,
28
+ origin: [
29
+ [
30
+ collect / [componentD ]/ index .js ,
31
+ 1 ,
32
+ ],
33
+ ],
34
+ placeholders: {},
35
+ },
36
+ }
37
+ ` ;
38
+
22
39
exports [` Catalog collect should extract files with special characters when passed in options 1` ] = `
23
40
{
24
41
Component C : {
Original file line number Diff line number Diff line change @@ -318,6 +318,21 @@ describe("Catalog", () => {
318
318
expect ( messages ) . toMatchSnapshot ( )
319
319
} )
320
320
321
+ it ( "should extract files with special characters in the include path" , async ( ) => {
322
+ const catalog = new Catalog (
323
+ {
324
+ name : "messages" ,
325
+ path : "locales/{locale}" ,
326
+ include : [ fixture ( "collect/[componentD]" ) ] ,
327
+ exclude : [ ] ,
328
+ format,
329
+ } ,
330
+ mockConfig ( )
331
+ )
332
+ const messages = await catalog . collect ( )
333
+ expect ( messages ) . toMatchSnapshot ( )
334
+ } )
335
+
321
336
it ( "should throw an error when duplicate identifier with different defaults found" , async ( ) => {
322
337
const catalog = new Catalog (
323
338
{
Original file line number Diff line number Diff line change @@ -264,22 +264,24 @@ export class Catalog {
264
264
}
265
265
266
266
get sourcePaths ( ) {
267
- const includeGlobs = this . include . map ( ( includePath ) => {
268
- const isDir = isDirectory ( includePath )
269
- /**
270
- * glob library results from absolute patterns such as /foo/* are mounted onto the root setting using path.join.
271
- * On windows, this will by default result in /foo/* matching C:\foo\bar.txt.
272
- */
273
- return isDir
274
- ? normalize (
275
- path . resolve (
276
- process . cwd ( ) ,
277
- includePath === "/" ? "" : includePath ,
278
- "**/*.*"
267
+ const includeGlobs = this . include
268
+ . map ( ( includePath ) => {
269
+ const isDir = isDirectory ( includePath )
270
+ /**
271
+ * glob library results from absolute patterns such as /foo/* are mounted onto the root setting using path.join.
272
+ * On windows, this will by default result in /foo/* matching C:\foo\bar.txt.
273
+ */
274
+ return isDir
275
+ ? normalize (
276
+ path . resolve (
277
+ process . cwd ( ) ,
278
+ includePath === "/" ? "" : includePath ,
279
+ "**/*.*"
280
+ )
279
281
)
280
- )
281
- : includePath
282
- } )
282
+ : includePath
283
+ } )
284
+ . map ( makePathRegexSafe )
283
285
284
286
return globSync ( includeGlobs , { ignore : this . exclude , mark : true } )
285
287
}
You can’t perform that action at this time.
0 commit comments