javascript console.log 안찍힘 - 꿀꺽 꿀꺽 : 모카 테스트 디버그 대상
1
Answers
노드의 Child Process
클래스를 사용하여 노드 응용 프로그램 내에서 명령 줄 명령을 실행할 수 있습니다. 귀하의 경우에는 childprocess.spawn ()을 권장합니다. 이벤트 이미 터 역할을하므로 data
를 구독하여 stdout
에서 출력을 검색 할 수 있습니다. 꿀꺽 꿀꺽 거리기에서 이것을 사용하는 측면에서, 다른 꿀꺽 꿀꺽 거리기 작업으로 파이프 될 수있는 스트림을 반환하기 위해 일부 작업을 수행해야 할 수도 있습니다.
크롬 f12 안될때
나는 꿀꺽 꿀꺽 거리는 모카 ( gulp -mocha)를 통해 달리는 매력처럼 작동하는 모카 테스트를 실행하기위한 gulp.js 목표를 가지고 있습니다. 질문 : 꿀꺽 꿀꺽 거리며 달리는 모카 테스트를 어떻게 디버그합니까? 노드 검사기 와 같은 것을 사용하여 내 src 및 테스트 파일의 중단 점을 설정하여 진행 상황을 확인하고 싶습니다. 나는 이미 노드를 직접 호출하여이 작업을 수행 할 수있다.
node --debug-brk node_modules/gulp/bin/gulp.js test
하지만 나는 이것을 감싸는 꿀꺽 꿀꺽 표적을 선호한다. 예를 들면 :
gulp.task('test-debug', 'Run unit tests in debug mode', function (cb) {
// todo?
});
아이디어? 꿀꺽 꿀꺽 알지 못하는 사람이 사용할 수있는 타겟으로 재사용 가능한 gulpfile
를 만들려고하기 때문에 bash
스크립트 나 다른 파일을 피하고 싶습니다.
여기 내 현재 gulpfile.js
// gulpfile.js
var gulp = require('gulp'),
mocha = require('gulp-mocha'),
gutil = require('gulp-util'),
help = require('gulp-help');
help(gulp); // add help messages to targets
var exitCode = 0;
// kill process on failure
process.on('exit', function () {
process.nextTick(function () {
var msg = "gulp '" + gulp.seq + "' failed";
console.log(gutil.colors.red(msg));
process.exit(exitCode);
});
});
function testErrorHandler(err) {
gutil.beep();
gutil.log(err.message);
exitCode = 1;
}
gulp.task('test', 'Run unit tests and exit on failure', function () {
return gulp.src('./lib/*/test/**/*.js')
.pipe(mocha({
reporter: 'dot'
}))
.on('error', function (err) {
testErrorHandler(err);
process.emit('exit');
});
});
gulp.task('test-watch', 'Run unit tests', function (cb) {
return gulp.src('./lib/*/test/**/*.js')
.pipe(mocha({
reporter: 'min',
G: true
}))
.on('error', testErrorHandler);
});
gulp.task('watch', 'Watch files and run tests on change', function () {
gulp.watch('./lib/**/*.js', ['test-watch']);
});
0 votes
javascript