Tôi đang cố gắng kiểm tra Intern để xem liệu nó có phù hợp với một khuôn khổ thử nghiệm hay không. Tôi đang cố gắng kiểm tra mã sau trong Intern.Không thể lấy Intern để chạy Mô-đun Node.js
var HelloWorld;
HelloWorld = (function() {
function HelloWorld (name) {
this.name = name || "N/A";
}
HelloWorld.prototype.printHello = function() {
console.log('Hello, ' + this.name);
};
HelloWorld.prototype.changeName = function(name) {
if (name === null || name === undefined) {
throw new Error('Name is required');
}
this.name = name;
};
return HelloWorld;
})();
exports = module.exports = HelloWorld;
Tệp nằm trong 'js-test-projects/node/lib/HelloWorld.js' và Intern được đặt tại 'js-test-projects/intern'. Tôi đang sử dụng chi nhánh Intern của 1.0.0. Bất cứ khi nào tôi cố gắng bao gồm các tập tin và chạy thử nghiệm tôi không nhận được bất kỳ đầu ra sau khi "Defaulting to console reporter". Đây là tệp thử nghiệm.
define([
'intern!tdd',
'intern/chai!assert',
'dojo/node!../lib/HelloWorld'
], function (tdd, assert, HelloWorld) {
console.log(HelloWorld);
});
Đối với một người không quen thuộc với nút. js, điều này nghe giống như một bài thực tập :) –
Tôi ghét khi tôi không thể có được thực tập sinh của tôi để điều tôi muốn. – AaronLS