FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/generate/missing-tests.js at v0.2.2 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
23
(23)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
generate
/
missing-tests.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (53 loc) · 1.77 KB
Breadcrumbs
nodegit
/
generate
/
missing-tests.js
Copy path
File metadata and controls
64 lines (53 loc) · 1.77 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
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
33
34
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
const
path
=
require
(
"path"
)
;
const
idefs
=
require
(
"./idefs"
)
;
const
Promise
=
require
(
"nodegit-promise"
)
;
const
promisify
=
require
(
"promisify-node"
)
;
const
fse
=
promisify
(
require
(
"fs-extra"
)
)
;
const
testFilesPath
=
path
.
resolve
(
__dirname
,
"../test/tests"
)
;
const
missingFileIgnores
=
require
(
"./missing-tests-ignore"
)
;
var
output
=
{
}
;
function
findMissingTest
(
idef
)
{
var
testFilePath
=
path
.
join
(
testFilesPath
,
idef
.
filename
+
".js"
)
;
var
result
=
{
}
;
return
fse
.
readFile
(
testFilePath
,
"utf8"
)
.
then
(
function
(
file
)
{
var
fieldsResult
=
[
]
;
var
functionsResult
=
[
]
;
var
fieldIgnores
=
(
missingFileIgnores
[
idef
.
filename
]
||
{
}
)
.
fields
;
var
functionIgnores
=
(
missingFileIgnores
[
idef
.
filename
]
||
{
}
)
.
functions
;
fieldIgnores
=
fieldIgnores
||
[
]
;
functionIgnores
=
functionIgnores
||
[
]
;
file
=
file
||
""
;
idef
.
fields
.
forEach
(
function
(
field
)
{
if
(
file
.
indexOf
(
field
.
jsFunctionName
)
<
0
&&
fieldIgnores
.
indexOf
(
field
.
jsFunctionName
<
0
)
)
{
fieldsResult
.
push
(
field
.
jsFunctionName
)
;
}
}
)
;
result
.
fields
=
fieldsResult
;
idef
.
functions
.
forEach
(
function
(
fn
)
{
if
(
file
.
indexOf
(
fn
.
jsFunctionName
)
<
0
&&
functionIgnores
.
indexOf
(
fn
.
jsFunctionName
)
<
0
)
{
functionsResult
.
push
(
fn
.
jsFunctionName
)
;
}
}
)
;
result
.
functions
=
functionsResult
;
}
,
function
(
)
{
result
.
testFileMissing
=
false
;
result
.
testFilePath
=
testFilePath
;
}
)
.
then
(
function
(
)
{
output
[
idef
.
filename
]
=
result
;
}
)
;
}
;
var
promises
=
[
]
;
idefs
.
forEach
(
function
(
idef
)
{
promises
.
push
(
findMissingTest
(
idef
)
)
;
}
)
;
Promise
.
all
(
promises
)
.
then
(
function
(
)
{
fse
.
writeFileSync
(
path
.
join
(
__dirname
,
"missing-tests.json"
)
,
JSON
.
stringify
(
output
,
null
,
2
)
)
;
}
,
function
(
fail
)
{
console
.
log
(
fail
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL