Add a few hooks to make it possible to extend functionality
This commit is contained in:
parent
280122cee3
commit
c20ee414f6
|
@ -22,8 +22,8 @@ public class JasmineTestRunner extends Runner {
|
|||
|
||||
private JasmineDescriptions jasmineSuite;
|
||||
|
||||
private final RhinoContext rhinoContext;
|
||||
private final JasmineSuite suiteAnnotation;
|
||||
protected final RhinoContext rhinoContext;
|
||||
protected final JasmineSuite suiteAnnotation;
|
||||
private final Class<?> testClass;
|
||||
|
||||
@JasmineSuite
|
||||
|
@ -48,6 +48,9 @@ public class JasmineTestRunner extends Runner {
|
|||
|
||||
private RhinoContext setUpRhinoScope() {
|
||||
RhinoContext context = new RhinoContext();
|
||||
|
||||
pre(context);
|
||||
|
||||
context.loadEnv(suiteAnnotation.jsRootDir());
|
||||
setUpJasmine(context);
|
||||
|
||||
|
@ -56,6 +59,9 @@ public class JasmineTestRunner extends Runner {
|
|||
return context;
|
||||
}
|
||||
|
||||
protected void pre(RhinoContext context) {
|
||||
}
|
||||
|
||||
private void setUpJasmine(RhinoContext context) {
|
||||
context.load(getJsLibDir() + "jasmine.js");
|
||||
context.load(getJsLibDir() + "jasmine.delegator_reporter.js");
|
||||
|
@ -138,9 +144,14 @@ public class JasmineTestRunner extends Runner {
|
|||
}
|
||||
}
|
||||
|
||||
after();
|
||||
}
|
||||
|
||||
protected void after() {
|
||||
this.rhinoContext.exit();
|
||||
}
|
||||
|
||||
|
||||
private Object createTestClassInstance() {
|
||||
try {
|
||||
return testClass.newInstance();
|
||||
|
|
Reference in New Issue