コードは次のとおりです。
(function() {
/*global casper:true */
"use strict";
this.run = function(casper) {
// code test here
};
this.run(casper);
})();
casperjs test myfile.js
戻り値 :
TypeError: 'undefined' is not an object (evaluating 'this.run = function(casper) {
}')
# type: uncaughtError
# error: "TypeError: 'undefined' is not an object (evaluating 'this.run = function(casper) {\n \n }')"
「usestrict」を削除すると、単にハングします(このテストは不完全であるため、予期される動作です)。厳密な使用法について理解していないルールがあると思いますが、返されたエラーはそれを明確にしません。