인턴을 테스트하여 테스트 프레임 워크에 적합한 지 확인하려고합니다. 인턴에서 다음 코드를 테스트하려고합니다.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;
파일은 'JS-테스트 프로젝트/인턴'에서 'JS-테스트 프로젝트/노드/lib 디렉토리 /하고 helloworld.js'및 인턴이 위치에 있습니다. 나는 Intern의 1.0.0 분기를 사용하고 있습니다. 파일을 포함시키고 테스트를 실행하려고 할 때마다 "콘솔 리포터를 기본값으로 설정"한 후에 출력을 얻지 못합니다. 다음은 테스트 파일입니다. (질문에 따라) 다음과 같은 디렉토리 구조를 가정
define([
'intern!tdd',
'intern/chai!assert',
'dojo/node!../lib/HelloWorld'
], function (tdd, assert, HelloWorld) {
console.log(HelloWorld);
});
노드에 익숙하지 않은 사람. js, 이것은 인턴쉽 게시처럼 들렸습니다 :) –
내가 원하는 것을 실행하기 위해 인턴을 얻을 수 없을 때 나는 싫어. – AaronLS