Actually even better would be
var string = " test1 test2 test3 test4 test5 test6 test7 ";
var arr = string.replace(/(^\s+|\s+$)/g,"").split(/\s+/g);
so it can also deal with multiple spaces at the beginning or end of the string.
However, as a general rule, when questions like this one come up I like to ask what it's for because this kind of thing might be an indication for bad design.