@wp-blocks/make-pot 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/lib/cli/parseCli.js +11 -12
- package/lib/cli/parseCli.js.map +1 -1
- package/lib/const.js +1 -12
- package/lib/const.js.map +1 -1
- package/lib/extractors/headers.d.ts +2 -3
- package/lib/extractors/headers.js +23 -13
- package/lib/extractors/headers.js.map +1 -1
- package/lib/extractors/index.d.ts +2 -2
- package/lib/extractors/index.js +15 -25
- package/lib/extractors/index.js.map +1 -1
- package/lib/extractors/json.d.ts +3 -2
- package/lib/extractors/json.js +17 -30
- package/lib/extractors/json.js.map +1 -1
- package/lib/extractors/schema.d.ts +73 -2
- package/lib/extractors/schema.js +31 -52
- package/lib/extractors/schema.js.map +1 -1
- package/lib/extractors/text.js +3 -4
- package/lib/extractors/text.js.map +1 -1
- package/lib/extractors/utils.d.ts +4 -4
- package/lib/extractors/utils.js +17 -16
- package/lib/extractors/utils.js.map +1 -1
- package/lib/fs/glob.d.ts +2 -2
- package/lib/fs/glob.js +9 -21
- package/lib/fs/glob.js.map +1 -1
- package/lib/fs/index.js +2 -13
- package/lib/fs/index.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/parser/exec.d.ts +0 -1
- package/lib/parser/exec.js +38 -60
- package/lib/parser/exec.js.map +1 -1
- package/lib/parser/index.d.ts +2 -2
- package/lib/parser/index.js +25 -19
- package/lib/parser/index.js.map +1 -1
- package/lib/parser/patterns.js +6 -7
- package/lib/parser/patterns.js.map +1 -1
- package/lib/parser/process.d.ts +4 -5
- package/lib/parser/process.js +25 -57
- package/lib/parser/process.js.map +1 -1
- package/lib/parser/progress.d.ts +3 -0
- package/lib/parser/progress.js +21 -0
- package/lib/parser/progress.js.map +1 -0
- package/lib/parser/taskRunner.d.ts +4 -0
- package/lib/parser/taskRunner.js +33 -0
- package/lib/parser/taskRunner.js.map +1 -0
- package/lib/parser/tree.d.ts +2 -2
- package/lib/parser/tree.js +40 -23
- package/lib/parser/tree.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +7 -2
- package/lib/utils/index.js.map +1 -1
- package/package.json +16 -3
- package/tests/extract.test.ts +95 -104
- package/tests/getFiles.test.ts +114 -114
- package/tests/ignoreFunction.test.ts +102 -126
- package/tests/tree.test.ts +6 -7
- package/tsconfig.json +3 -3
- package/lib/cliArgs.d.ts +0 -4
- package/lib/cliArgs.js +0 -216
- package/lib/cliArgs.js.map +0 -1
- package/lib/consolidate.d.ts +0 -2
- package/lib/consolidate.js +0 -37
- package/lib/consolidate.js.map +0 -1
- package/lib/fs.d.ts +0 -2
- package/lib/fs.js +0 -69
- package/lib/fs.js.map +0 -1
- package/lib/glob.d.ts +0 -13
- package/lib/glob.js +0 -95
- package/lib/glob.js.map +0 -1
- package/lib/makePot.d.ts +0 -2
- package/lib/makePot.js +0 -83
- package/lib/makePot.js.map +0 -1
- package/lib/maps.d.ts +0 -122
- package/lib/maps.js +0 -73
- package/lib/maps.js.map +0 -1
- package/lib/parser/consolidate.d.ts +0 -2
- package/lib/parser/consolidate.js +0 -37
- package/lib/parser/consolidate.js.map +0 -1
- package/lib/parser/makePot.d.ts +0 -2
- package/lib/parser/makePot.js +0 -35
- package/lib/parser/makePot.js.map +0 -1
- package/lib/parser.d.ts +0 -6
- package/lib/parser.js +0 -110
- package/lib/parser.js.map +0 -1
- package/lib/tree.d.ts +0 -2
- package/lib/tree.js +0 -78
- package/lib/tree.js.map +0 -1
- package/lib/utils.d.ts +0 -8
- package/lib/utils.js +0 -78
- package/lib/utils.js.map +0 -1
- package/tests/consolidate.test.ts +0 -77
- package/tests/getStrings.test.ts +0 -85
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/tests/{jsonParse.test.ts → jsonParse.ts} +0 -0
package/tests/getFiles.test.ts
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { describe, expect } from '@jest/globals'
|
|
2
|
-
import { getFiles } from '../src/fs/glob'
|
|
3
|
-
import { Args, DomainType } from '../src/types'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { parseCliArgs } from '../src/cli/parseCli'
|
|
6
|
-
|
|
7
|
-
describe('getFiles', () => {
|
|
8
|
-
const DEFAULTS = parseCliArgs({
|
|
9
|
-
domain: 'plugin' as DomainType,
|
|
10
|
-
slug: 'plugin-slug',
|
|
11
|
-
paths: { cwd: 'tests/fixtures/', out: 'tests/fixtures/' },
|
|
12
|
-
options: {
|
|
13
|
-
silent: true,
|
|
14
|
-
},
|
|
15
|
-
$0: 'makepot',
|
|
16
|
-
_: [0, 1],
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('should retrieve a all files', async () => {
|
|
20
|
-
const args = { ...DEFAULTS, domain: 'theme' } as Args
|
|
21
|
-
const pattern = { include: ['**'], exclude: [] }
|
|
22
|
-
|
|
23
|
-
const files = await getFiles(args, pattern)
|
|
24
|
-
const collected: string[] = []
|
|
25
|
-
for (const file of files) {
|
|
26
|
-
expect(file).toBeTruthy()
|
|
27
|
-
collected.push(file)
|
|
28
|
-
}
|
|
29
|
-
expect(collected.length).toBeGreaterThan(2)
|
|
30
|
-
expect(collected.find((e) => e.includes('theme.json'))).toBeTruthy()
|
|
31
|
-
})
|
|
32
|
-
it('Should retrieve a list of txt files based on the provided plugin pattern', async () => {
|
|
33
|
-
const args = {
|
|
34
|
-
...DEFAULTS,
|
|
35
|
-
}
|
|
36
|
-
const pattern = {
|
|
37
|
-
include: ['**/*.txt'],
|
|
38
|
-
exclude: ['node_modules', 'dist'],
|
|
39
|
-
}
|
|
40
|
-
const expectedFiles = [
|
|
41
|
-
'tests' + path.sep + 'fixtures' + path.sep + 'file1.txt',
|
|
42
|
-
'tests' +
|
|
43
|
-
path.sep +
|
|
44
|
-
'fixtures' +
|
|
45
|
-
path.sep +
|
|
46
|
-
'sourcedir' +
|
|
47
|
-
path.sep +
|
|
48
|
-
'file2.txt',
|
|
49
|
-
'tests' +
|
|
50
|
-
path.sep +
|
|
51
|
-
'fixtures' +
|
|
52
|
-
path.sep +
|
|
53
|
-
'block' +
|
|
54
|
-
path.sep +
|
|
55
|
-
'readme.txt',
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
const files = await getFiles(args, pattern)
|
|
59
|
-
const collected: string[] = []
|
|
60
|
-
for (const file of files) {
|
|
61
|
-
expect(file).toBeTruthy()
|
|
62
|
-
collected.push(file)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
expect(collected).toEqual(expectedFiles)
|
|
66
|
-
})
|
|
67
|
-
it('should retrieve a list of theme.json files based on the provided theme pattern', async () => {
|
|
68
|
-
const args = {
|
|
69
|
-
...DEFAULTS,
|
|
70
|
-
}
|
|
71
|
-
const pattern = {
|
|
72
|
-
include: ['**/*.json'],
|
|
73
|
-
exclude: [],
|
|
74
|
-
}
|
|
75
|
-
const expectedFiles = [
|
|
76
|
-
`sourcedir${path.sep}theme.json`,
|
|
77
|
-
`sourcedir${path.sep}package.json`,
|
|
78
|
-
`sourcedir${path.sep}node_modules${path.sep}module${path.sep}block.json`,
|
|
79
|
-
`node_modules${path.sep}block.json`,
|
|
80
|
-
`fse${path.sep}theme.json`,
|
|
81
|
-
`block${path.sep}block.json`,
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
const files = await getFiles(args, pattern)
|
|
85
|
-
|
|
86
|
-
for (const file of files) {
|
|
87
|
-
expect(file).toBeTruthy()
|
|
88
|
-
collected.push(file)
|
|
89
|
-
}
|
|
90
|
-
expect(
|
|
91
|
-
collected.filter((file) => !expectedFiles.includes(file))
|
|
92
|
-
).toBeTruthy()
|
|
93
|
-
})
|
|
94
|
-
it('Should retrieve a list of files without any node_modules folder', async () => {
|
|
95
|
-
const args = {
|
|
96
|
-
...DEFAULTS,
|
|
97
|
-
}
|
|
98
|
-
const pattern = {
|
|
99
|
-
include: ['**'],
|
|
100
|
-
exclude: ['node_modules'],
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const files = await getFiles(args, pattern)
|
|
104
|
-
|
|
105
|
-
for (const file of files) {
|
|
106
|
-
expect(file).toBeTruthy()
|
|
107
|
-
collected.push(file)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// for each file check if that strings contains the node_modules folder
|
|
111
|
-
expect(collected.find((e) => e.includes('node_modules'))).toBeFalsy()
|
|
112
|
-
expect(collected.length).toBeGreaterThan(10)
|
|
113
|
-
})
|
|
114
|
-
})
|
|
1
|
+
import { describe, expect } from '@jest/globals'
|
|
2
|
+
import { getFiles } from '../src/fs/glob'
|
|
3
|
+
import { Args, DomainType } from '../src/types'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import { parseCliArgs } from '../src/cli/parseCli'
|
|
6
|
+
|
|
7
|
+
describe('getFiles', () => {
|
|
8
|
+
const DEFAULTS = parseCliArgs({
|
|
9
|
+
domain: 'plugin' as DomainType,
|
|
10
|
+
slug: 'plugin-slug',
|
|
11
|
+
paths: { cwd: 'tests/fixtures/', out: 'tests/fixtures/' },
|
|
12
|
+
options: {
|
|
13
|
+
silent: true,
|
|
14
|
+
},
|
|
15
|
+
$0: 'makepot',
|
|
16
|
+
_: [0, 1],
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('should retrieve a all files', async () => {
|
|
20
|
+
const args = { ...DEFAULTS, domain: 'theme' } as Args
|
|
21
|
+
const pattern = { include: ['**'], exclude: [] }
|
|
22
|
+
|
|
23
|
+
const files = await getFiles(args, pattern)
|
|
24
|
+
const collected: string[] = []
|
|
25
|
+
for (const file of files) {
|
|
26
|
+
expect(file).toBeTruthy()
|
|
27
|
+
collected.push(file)
|
|
28
|
+
}
|
|
29
|
+
expect(collected.length).toBeGreaterThan(2)
|
|
30
|
+
expect(collected.find((e) => e.includes('theme.json'))).toBeTruthy()
|
|
31
|
+
})
|
|
32
|
+
it('Should retrieve a list of txt files based on the provided plugin pattern', async () => {
|
|
33
|
+
const args = {
|
|
34
|
+
...DEFAULTS,
|
|
35
|
+
}
|
|
36
|
+
const pattern = {
|
|
37
|
+
include: ['**/*.txt'],
|
|
38
|
+
exclude: ['node_modules', 'dist'],
|
|
39
|
+
}
|
|
40
|
+
const expectedFiles = [
|
|
41
|
+
'tests' + path.sep + 'fixtures' + path.sep + 'file1.txt',
|
|
42
|
+
'tests' +
|
|
43
|
+
path.sep +
|
|
44
|
+
'fixtures' +
|
|
45
|
+
path.sep +
|
|
46
|
+
'sourcedir' +
|
|
47
|
+
path.sep +
|
|
48
|
+
'file2.txt',
|
|
49
|
+
'tests' +
|
|
50
|
+
path.sep +
|
|
51
|
+
'fixtures' +
|
|
52
|
+
path.sep +
|
|
53
|
+
'block' +
|
|
54
|
+
path.sep +
|
|
55
|
+
'readme.txt',
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
const files = await getFiles(args, pattern)
|
|
59
|
+
const collected: string[] = []
|
|
60
|
+
for (const file of files) {
|
|
61
|
+
expect(file).toBeTruthy()
|
|
62
|
+
collected.push(file)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
expect(collected).toEqual(expectedFiles)
|
|
66
|
+
})
|
|
67
|
+
it('should retrieve a list of theme.json files based on the provided theme pattern', async () => {
|
|
68
|
+
const args = {
|
|
69
|
+
...DEFAULTS,
|
|
70
|
+
}
|
|
71
|
+
const pattern = {
|
|
72
|
+
include: ['**/*.json'],
|
|
73
|
+
exclude: [],
|
|
74
|
+
}
|
|
75
|
+
const expectedFiles = [
|
|
76
|
+
`sourcedir${path.sep}theme.json`,
|
|
77
|
+
`sourcedir${path.sep}package.json`,
|
|
78
|
+
`sourcedir${path.sep}node_modules${path.sep}module${path.sep}block.json`,
|
|
79
|
+
`node_modules${path.sep}block.json`,
|
|
80
|
+
`fse${path.sep}theme.json`,
|
|
81
|
+
`block${path.sep}block.json`,
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
const files = await getFiles(args, pattern)
|
|
85
|
+
const collected = []
|
|
86
|
+
for (const file of files) {
|
|
87
|
+
expect(file).toBeTruthy()
|
|
88
|
+
collected.push(file)
|
|
89
|
+
}
|
|
90
|
+
expect(
|
|
91
|
+
collected.filter((file) => !expectedFiles.includes(file))
|
|
92
|
+
).toBeTruthy()
|
|
93
|
+
})
|
|
94
|
+
it('Should retrieve a list of files without any node_modules folder', async () => {
|
|
95
|
+
const args = {
|
|
96
|
+
...DEFAULTS,
|
|
97
|
+
}
|
|
98
|
+
const pattern = {
|
|
99
|
+
include: ['**'],
|
|
100
|
+
exclude: ['node_modules'],
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const files = await getFiles(args, pattern)
|
|
104
|
+
const collected = []
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
expect(file).toBeTruthy()
|
|
107
|
+
collected.push(file)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// for each file check if that strings contains the node_modules folder
|
|
111
|
+
expect(collected.find((e) => e.includes('node_modules'))).toBeFalsy()
|
|
112
|
+
expect(collected.length).toBeGreaterThan(10)
|
|
113
|
+
})
|
|
114
|
+
})
|
|
@@ -1,126 +1,102 @@
|
|
|
1
|
-
import { describe, expect } from '@jest/globals'
|
|
2
|
-
import { Glob, Path } from 'glob'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
title: '
|
|
33
|
-
src: '
|
|
34
|
-
exclude: [
|
|
35
|
-
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
tests.forEach((test) => {
|
|
104
|
-
it('should ignore files ' + test.title, () => {
|
|
105
|
-
const foundDirs: string[] = []
|
|
106
|
-
|
|
107
|
-
const dirs = new Glob('**', {
|
|
108
|
-
ignore: {
|
|
109
|
-
ignored: (p: Path) => ignoreFunc(p, test.exclude),
|
|
110
|
-
},
|
|
111
|
-
nodir: true,
|
|
112
|
-
cwd: path.join(process.cwd(), test.src),
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
for (const dir of dirs) {
|
|
116
|
-
foundDirs.push(dir)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (typeof test.result === 'number') {
|
|
120
|
-
expect(foundDirs.length).toBeGreaterThanOrEqual(test.result)
|
|
121
|
-
} else {
|
|
122
|
-
expect(foundDirs).toStrictEqual(test.result)
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
})
|
|
1
|
+
import { describe, expect } from '@jest/globals'
|
|
2
|
+
import { Glob, Path } from 'glob'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import { ignoreFunc } from '../src/fs/glob'
|
|
5
|
+
|
|
6
|
+
const tests = [
|
|
7
|
+
{
|
|
8
|
+
title: 'defaults',
|
|
9
|
+
src: '.',
|
|
10
|
+
exclude: [
|
|
11
|
+
'.git',
|
|
12
|
+
'node_modules',
|
|
13
|
+
'vendor',
|
|
14
|
+
'build',
|
|
15
|
+
'dist',
|
|
16
|
+
'uploads',
|
|
17
|
+
'Gruntfile.js',
|
|
18
|
+
'webpack.config.js',
|
|
19
|
+
'**/*.min.js',
|
|
20
|
+
'tsconfig.js',
|
|
21
|
+
'**.test.**',
|
|
22
|
+
'tests',
|
|
23
|
+
'coverage',
|
|
24
|
+
'**/extractors**',
|
|
25
|
+
'**/*.js.map',
|
|
26
|
+
'**/lib/c**.d.ts',
|
|
27
|
+
'**/**tt**',
|
|
28
|
+
],
|
|
29
|
+
result: 20,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: 'exclude file.php',
|
|
33
|
+
src: 'tests/fixtures/sourcedir',
|
|
34
|
+
exclude: ['file.php'],
|
|
35
|
+
result: [
|
|
36
|
+
'theme.json',
|
|
37
|
+
'svgTools.ts',
|
|
38
|
+
'sourcedir.php',
|
|
39
|
+
'package.json',
|
|
40
|
+
'file2.txt',
|
|
41
|
+
'vendor' + path.sep + 'index.php',
|
|
42
|
+
'node_modules' + path.sep + 'module' + path.sep + 'block.json',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: 'exclude node_modules and vendor',
|
|
47
|
+
src: 'tests/fixtures/sourcedir',
|
|
48
|
+
exclude: ['node_modules', 'vendor'],
|
|
49
|
+
result: [
|
|
50
|
+
'theme.json',
|
|
51
|
+
'svgTools.ts',
|
|
52
|
+
'sourcedir.php',
|
|
53
|
+
'package.json',
|
|
54
|
+
'file2.txt',
|
|
55
|
+
'file.php',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: 'globstar path',
|
|
60
|
+
src: 'tests/fixtures',
|
|
61
|
+
exclude: ['**/*.php', '**/*.json', 'block/**'],
|
|
62
|
+
result: 15,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: 'should exclude globstar',
|
|
66
|
+
src: 'tests/fixtures/',
|
|
67
|
+
exclude: ['**'],
|
|
68
|
+
result: [],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: 'should remove excluded patterns',
|
|
72
|
+
src: 'tests/fixtures/node_modules',
|
|
73
|
+
exclude: [],
|
|
74
|
+
result: ['block.json'],
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
describe('testing the ignoreFunc used to ignore files', () => {
|
|
79
|
+
tests.forEach((test) => {
|
|
80
|
+
it('should ignore files ' + test.title, () => {
|
|
81
|
+
const foundDirs: string[] = []
|
|
82
|
+
|
|
83
|
+
const dirs = new Glob('**', {
|
|
84
|
+
ignore: {
|
|
85
|
+
ignored: (p: Path) => ignoreFunc(p, test.exclude),
|
|
86
|
+
},
|
|
87
|
+
nodir: true,
|
|
88
|
+
cwd: path.join(test.src),
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
for (const dir of dirs) {
|
|
92
|
+
foundDirs.push(dir)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (typeof test.result === 'number') {
|
|
96
|
+
expect(foundDirs.length).toBeGreaterThanOrEqual(test.result)
|
|
97
|
+
} else {
|
|
98
|
+
expect(foundDirs).toStrictEqual(test.result)
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
})
|
package/tests/tree.test.ts
CHANGED
|
@@ -138,15 +138,14 @@ describe('doTree php test file', () => {
|
|
|
138
138
|
|
|
139
139
|
const filename = 'filename.php'
|
|
140
140
|
|
|
141
|
-
const r = doTree(content, filename)
|
|
141
|
+
const r = doTree(content, filename).blocks
|
|
142
142
|
const res = Object.values(r)[0]
|
|
143
|
-
const translations = Object.keys(res)
|
|
144
|
-
const comments = Object.entries(res).filter(
|
|
145
|
-
([x, translation]) => !!translation.comments?.translator
|
|
146
|
-
)
|
|
147
143
|
|
|
148
|
-
|
|
149
|
-
expect(
|
|
144
|
+
/** TODO: fix this test - btw i counted 19 blocks and 8 comments in the test file */
|
|
145
|
+
expect(r.map((block) => block).length).toBeGreaterThanOrEqual(19)
|
|
146
|
+
expect(
|
|
147
|
+
r.filter((block) => block.comments).length
|
|
148
|
+
).toBeGreaterThanOrEqual(8)
|
|
150
149
|
expect(res).toMatchSnapshot()
|
|
151
150
|
})
|
|
152
151
|
})
|
package/tsconfig.json
CHANGED
package/lib/cliArgs.d.ts
DELETED