该文档STRATE你可以传递一个options对象casperjs.create()包括JS clientScripts注入到客户端页面.
该文件还规定,你不应该在一个测试文件casper.create实例.
文档没有说明(至少我找不到)如何使用optionscasper.tester类的对象.我确实尝试过这样的事情:
casper.options = {
    clientScripts:[
        '../testlib/sinon-1.7.3.js'
        ],
    logLevel:"warning",
    verbose:true
};  
之前casper.test.begin但它打破了测试.
把它放在test.begin和casper.start之间.
casper.test.begin('Basic index.html elements test',14, function suite(test){
    casper.options..etc
    casper.start(url, function(){
    //also tried here
而在它下面也打破了测试
我会为这方面的任何方向感到高兴.特别是注射部件
您需要将文件推入,casper.option.clientScripts以免破坏设置的其他选项casper test.
casper.options.clientScripts.push("../testlib/sinon-1.7.3.js");
资料来源:CasperJS邮件列表