<commit_before>var Dictionary = require('dictionaryjs');
var dictData = new Dictionary();

try {
    var TestData = require("../../data/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js");
    var testData = new TestData();
    testData.load(dictData);
} catch(err) {
    console.log(err)
}

// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
describe('Pre-test setup for vanillaTestName', function () {

    it("Set PLACEHOLDERs for vanillaTestName test script", function () {
        var replace = require("replace");
        var sReplacement = "";

        var iMinValue = 0;
        var iMaxValue = 0;
        var iInterval = 0;

        var iStartValue = 0;
        var iIncrement = 0;
        var sResetOrigLine = "";
        var sResetNewLine = "";

        dictData.forEach(function(dicKey, dicValue) {
            switch(dicValue.substr(1,4).toUpperCase()){
                case "RAND":
                    iMinValue = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[0]).trim());
                    iMaxValue = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[1]).trim());
                    iInterval = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[2]).trim());
                    sReplacement = Math.floor((Math.random()*(iMaxValue - iMinValue +1) + iMinValue)/iInterval)*iInterval;
                    console.log ("Placeholder " + dicKey + " = " + dicValue + " (" + dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + ") set to " + sReplacement);

                    replace({
                        regex: dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
                        replacement: sReplacement,
                        paths: ["./data/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });

                    break;
                case "SEQU":
                case 'INCR':
                	//{SEQUENCE()) --> replacement
                    iStartValue = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[0]).trim());
                    iIncrement = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[1]).trim());
                    sReplacement = iStartValue+iIncrement;
                    console.log ("Placeholder " + dicKey + " = " + dicValue + " (" + dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + ") set to " + sReplacement);

                    replace({
                        regex: dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), 
                        replacement: sReplacement,
                        paths: ["./data/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });

                    //------ now increment the reset version ----
                    sResetOrigLine = "'#{" + dicKey.replace(/#/g, '') + "}#', '" + dicValue.substr(1, dicValue.length-2) + "'";
                    sResetNewLine = sResetOrigLine.replace(iStartValue, sReplacement);
                    console.log ("Placeholder orig line " + sResetOrigLine + " set to " + sResetNewLine);

                    replace({
                        regex: sResetOrigLine.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
                        replacement: sResetNewLine,
                        paths: ["./data/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });


                    break;
                default:
                    break;
            }
        });
    }, 600000);
}, 600000);<commit_msg>figured out how to reset and setup in one go<commit_after>var replace = require("replace");

var Dictionary = require('dictionaryjs');
var dictData = new Dictionary();

// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
describe('Pre-test setup for vanillaTestName', function () {
    it("Reset PLACEHOLDERs for vanillaTestName test script", function () {
        var sKey = "";
        var sReplacement = "";

        try {
            var TestData = require("../../tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js");
            var testData = new TestData();
            testData.load(dictData);
        } catch(err) {
            console.log(err)
        }

        dictData.forEach(function(dicKey, dicValue) {
            switch(dicKey.substr(1, 1).toUpperCase()){
                case "{":
                    //{PARAMETER)) --> replacement
                    sKey = "'#" + dicKey.substr(2, dicKey.length-4) + "#'" ;
                    sReplacement = sKey + ", '{" + dicValue + "}');";
                    console.log ("Reset Placeholder " + sKey + " to " + sReplacement);

                    replace({
                        regex: sKey + ', .*',
                        replacement: sReplacement,
                        paths: ["./tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });

                    break;
                default:
                    break;
            }
        });
    }, 600000);

    it("Set PLACEHOLDERs for vanillaTestName test script", function () {
        var sReplacement = "";

        var iMinValue = 0;
        var iMaxValue = 0;
        var iInterval = 0;

        var iStartValue = 0;
        var iIncrement = 0;
        var sResetOrigLine = "";
        var sResetNewLine = "";

        try {
            delete require.cache[require.resolve("../../tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js")];
            var TestData = require("../../tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js");
            var testData = new TestData();
            testData.load(dictData);
        } catch(err) {
            console.log(err)
        }

        dictData.forEach(function(dicKey, dicValue) {
            switch(dicValue.substr(1,4).toUpperCase()){
                case "RAND":
                    iMinValue = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[0]).trim());
                    iMaxValue = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[1]).trim());
                    iInterval = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[2]).trim());
                    sReplacement = Math.floor((Math.random()*(iMaxValue - iMinValue +1) + iMinValue)/iInterval)*iInterval;
                    console.log ("Placeholder " + dicKey + " = " + dicValue + " (" + dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + ") set to " + sReplacement);

                    replace({
                        regex: dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
                        replacement: sReplacement,
                        paths: ["./tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });

                    break;
                case "SEQU":
                case 'INCR':
                	//{SEQUENCE()) --> replacement
                    iStartValue = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[0]).trim());
                    iIncrement = Number((dicValue.substr(dicValue.indexOf("(")+1, dicValue.indexOf(")") - dicValue.indexOf("(")-1).split(",")[1]).trim());
                    sReplacement = iStartValue+iIncrement;
                    console.log ("Placeholder " + dicKey + " = " + dicValue + " (" + dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + ") set to " + sReplacement);

                    replace({
                        regex: dicValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
                        replacement: sReplacement,
                        paths: ["./tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });

                    //------ now increment the reset version ----
                    sResetOrigLine = "'#{" + dicKey.replace(/#/g, '') + "}#', '" + dicValue.substr(1, dicValue.length-2) + "'";
                    sResetNewLine = sResetOrigLine.replace(iStartValue, sReplacement);
                    console.log ("Placeholder orig line " + sResetOrigLine + " set to " + sResetNewLine);

                    replace({
                        regex: sResetOrigLine.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
                        replacement: sResetNewLine,
                        paths: ["./tests/TestData/" + browser.params.testEnv + ".vanillaTestName.data.js"],
                        recursive: false,
                        silent: true
                    });
                    break;
                default:
                    break;
            }
        });
    }, 600000);

}, 600000);
{'fraction_non_alphanumeric': 0.20266776962051494, 'fraction_numerical': 0.008685761555164926, 'mean_word_length': 1.4541994417660493, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6018919', 'n_tokens_mistral': 2737, 'n_tokens_neox': 2582, 'n_words': 422}