0
目前,我正在爲intern.js的自定義html記者工作。我使用的模板引擎是marko.js。 marko.js有「.marko」對我來說,輸入 該文件在正常node.js的正確生成,我的HTML語法擴展文件(common.js)通過在intern.js自動添加.js文件擴展名更改requireJS
當我整合了相同的代碼來實習生髮生問題.js文件。該requirejs(AMD)的internjs在使用自動添加.js文件擴展我的Marko分機當我這樣做
var template = require('./hello-world.marko');
這使得文件變得hello-world.marko.js
,這引起了代碼markojs
的爆發自定義HTML代碼記者低於
define(function (require) {
// require('intern/dojo/node!marko/node-require').install();
var fs = require('intern/dojo/node!fs');
var template = require('./hello-world.marko');
console.log(template);
function JsonReporter(config) {
config = config || {};
this.output = config.output;
}
JsonReporter.prototype = {
runEnd(executor) {
// console.log("toJson: " + JSON.stringify(executor.suites))
data = JSON.stringify(executor.suites);
template.renderToString(data,
function (err, output) {
console.log(output);
fs.writeFile('result.html', output, function (err) {
if (err) return console.log(err);
console.log('Save done');
});
});
},
}
return JsonReporter;
})