You need to define an actual RegExp
object.
new RegExp(testcases, 'g');
However be advised that if your string contains characters that needs to be escaped in a regular expression pattern, it could lead to unexpected results.
E.g
var s = 'test.',
rx = new RegExp(s);
rx.test('test1'); //true, because . matches almost anything
Therefore, you would have to escape it in the input string.
rx = new RegExp(s.replace(/\./, '\\.'));
rx.test('test1'); //false
rx.test('test.'); //true