public void runJsTests(File[] tests) throws IOException {
ContextFactory factory = ContextFactory.getGlobal();
Context cx = factory.enterContext();
try {
cx.setOptimizationLevel(this.optimizationLevel);
Scriptable shared = cx.initStandardObjects();
for (File f : tests) {
int length = (int) f.length(); // don't worry about very long
// files
char[] buf = new char[length];
new FileReader(f).read(buf, 0, length);