Skip to content

Commit d5e4c93

Browse files
committed
Detect and mark Typescript test modules
1 parent ee2949c commit d5e4c93

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Detect and mark test modules
2+
3+
MATCH (m:Module)
4+
WITH m
5+
,(m.globalFqn contains '/__tests__/') OR
6+
(m.globalFqn contains '/test/') OR
7+
(m.globalFqn contains '/tests/') AS isInTestFolder
8+
,(m.globalFqn contains '/__mocks__/') OR
9+
(m.globalFqn contains '/mock/') OR
10+
(m.globalFqn contains '/mocks/') AS isInMockFolder
11+
,(m.globalFqn ENDS WITH '.test.' + m.extension) OR
12+
(m.globalFqn ENDS WITH '/test.' + m.extension) OR
13+
(m.globalFqn ENDS WITH 'Test.' + m.extension) AS isTestExtension
14+
,(m.globalFqn ENDS WITH '.spec.' + m.extension) OR
15+
(m.globalFqn ENDS WITH '/spec.' + m.extension) OR
16+
(m.globalFqn ENDS WITH 'Spec.' + m.extension) AS isSpecificationExtension
17+
//,(m.globalFqn contains 'test') AS isTestMentioned // for debugging
18+
SET m.isTest = isInTestFolder OR isInMockFolder OR isTestExtension OR isSpecificationExtension
19+
RETURN isInTestFolder, isInMockFolder, isTestExtension, isSpecificationExtension
20+
//,isTestMentioned // for debugging
21+
,count(DISTINCT m.globalFqn) AS numberOfModules
22+
,collect(DISTINCT m.globalFqn)[0..4] AS examples

scripts/prepareAnalysis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ execute_cypher "${CYPHER_DIR}/Create_Typescript_index_for_name.cypher"
5555
# Preparation - Enrich Graph for Typescript by adding "module" and "name" properties
5656
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Index_module_name.cypher"
5757
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_module_properties.cypher"
58+
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Mark_test_modules.cypher"
5859

5960
# Preparation - Enrich Graph for Typescript by adding a name properties
6061
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_name_to_property_on_projects.cypher"

0 commit comments

Comments
 (0)