1313
1414# VARIABLES #
1515
16- # Determine the root project directory:
17- root_dir=$( dirname " $0 " ) /../..
18- root_dir=$( cd " ${root_dir} " && echo $PWD )
19-
2016# Define a username:
2117username=" ${CIRCLE_USERNAME} "
2218
@@ -26,11 +22,18 @@ total_nodes="${CIRCLE_NODE_TOTAL}"
2622# Get the VM index:
2723index=" ${CIRCLE_NODE_INDEX} "
2824
25+ # Define an output directory to store unit test results:
26+ tests_log_dir=" ${CIRCLE_TEST_REPORTS} /junit"
27+
2928# Define an output file to store log output:
3029log_file=' /var/log/circle-ci.log'
3130
32- # Define an output directory to store unit test results:
33- tests_log_dir=" ${CIRCLE_TEST_REPORTS} /junit"
31+ # Determine the root project directory:
32+ root_dir=$( dirname " $0 " ) /../..
33+ root_dir=$( cd " ${root_dir} " && echo $PWD )
34+
35+ # Define the project source code directory:
36+ base_dir=" ${root_dir} /lib/node_modules"
3437
3538# Define the pattern for test filenames:
3639tests_pattern=' test*.js'
@@ -271,14 +274,14 @@ run_tests() {
271274 # Extract the test directory:
272275 dir=$( dirname ${test} )
273276
274- # Remove the root directory path from the test directory path (using POSIX shell variable expansion):
275- path=" ${dir# ${root_dir } / } "
277+ # Remove the base source code directory path from the test directory path (using POSIX shell variable expansion):
278+ path=" ${dir# ${base_dir } / } "
276279
277280 # Slugify the path (basic algorithm):
278281 slug=" $( echo ${path} | sed -e ' s/[^[:alnum:]]/_/g' | tr -s ' -' | tr A-Z a-z) "
279282
280283 # Define the output log file path:
281- log_file=" $2 /test_results ${slug} .xml"
284+ log_file=" $2 /test-results. ${slug} .xml"
282285
283286 # Create the log file:
284287 create_log_file " ${log_file} "
0 commit comments