2015-01-24 3 views
7

저는 오늘 Jest에서 시작했습니다. 내 __tests__ 디렉토리에 간단한 테스트 파일이 있습니다. 다음은 현재 테스트 파일입니다.Jest로 여러 테스트 파일을 실행할 수 없습니까?

describe('ChangeCalendarView', function() { 
    it('true', function() { 
     expect(3).toBe(3); 
    }) 
}); 

이 파일은 문제없이 실행됩니다. 내가 설명 이외, 똑같은 코드로, 다른 파일을 추가 할 때 :

describe('ChangeTimePeriod', function() { 
    it('true', function() { 
     expect(3).toBe(3); 
    }) 
}); 

을 그 때 나는이 오류가 :

/usr/local/lib/node_modules/jest-cli/node_modules/node-worker-pool/Worker.js:93 
    throw new Error('Received unexpected data from child process: ' + data); 
     ^
Error: Received unexpected data from child process: { 
    "error": "Error: ENOENT, open '/usr/local/lib/node_modules/jest-cli/.haste_cache/cache-react-calendar-component'\n\n" 
} 
    at Worker._onStdout (/usr/local/lib/node_modules/jest-cli/node_modules/node-worker-pool/Worker.js:93:11) 

사람이 메이크업 감각을합니까?

+0

흠, 환경 또는 그 시험 블록 주위에 하나 뭔가 다른 일이 일어나고,이 있어야합니다. _any_ 새로운 테스트 파일을 추가하거나 특정 테스트 파일을 추가 할 때 이런 일이 발생합니까? –

+1

내가 추가 한 파일은 같은 일이 발생합니다. 그러나 하나의 파일 만 남기면 항상 실행됩니다. – jhamm

+0

테스트의 파일 이름은 무엇입니까? 나는 그것이 농담으로 주차 문제인지 궁금해. 또한 어리석은 것처럼 보일 수도 있지만 node_modules를 날려 버리고 npm을 다시 실행 해 봅니다. –

답변

3

babel-jest를 사용하여이 문제를 해결했습니다. 여기 내 package.json

{ 
    "name": "myapp", 
    "version": "0.0.0", 
    "dependencies": { 
    "classnames": "^2.1.3", 
    "dev": "^0.1.3", 
    "flux": "^2.0.3", 
    "grunt": "^0.4.5", 
    "gulp": "^3.9.0", 
    "immutable": "^3.7.4", 
    "install": "^0.1.8", 
    "lodash": "^3.10.0", 
    "node-simple-static-server": "^1.1.0", 
    "react-bootstrap": "^0.23.7", 
    "react-router": "^0.13.3", 
    "react-router-bootstrap": "^0.18.0", 
    "react-tools": "^0.13.0-beta.2", 
    "stackup": "^1.0.1" 
    }, 
    "devDependencies": { 
    "babel-jest": "^5.3.0", 
    "babelify": "^6.1.2", 
    "browser-sync": "latest", 
    "browserify-shim": "^3.8.0", 
    "del": "~0.1.3", 
    "gulp-autoprefixer": "~1.0.1", 
    "gulp-bower": "0.0.6", 
    "gulp-cache": "~0.2.4", 
    "gulp-imagemin": "latest", 
    "gulp-jshint": "~1.8.5", 
    "gulp-load-plugins": "~0.7.0", 
    "gulp-ruby-sass": "~0.7.1", 
    "gulp-size": "~1.1.0", 
    "gulp-strip-debug": "^1.0.2", 
    "gulp-stylus": "~2.0.1", 
    "gulp-uglify": "^1.0.2", 
    "gulp-useref": "~0.4.4", 
    "gulp-util": "~3.0.1", 
    "gulp-webserver": "latest", 
    "jest-cli": "*", 
    "main-bower-files": "~2.6.2", 
    "react": "latest", 
    "react-tools": "latest", 
    "reactify": "latest", 
    "strip-debug": "^1.0.1", 
    "vinyl-source-stream": "^1.0.0", 
    "watchify": "~2.1" 
    }, 
    "engines": { 
    "node": ">=0.10.0" 
    }, 
    "scripts": { 
    "test": "jest" 
    }, 
    "jest": { 
    "scriptPreprocessor": "../node_modules/babel-jest", 
    "testFileExtensions": [ 
     "es6", 
     "js" 
    ], 
    "moduleFileExtensions": [ 
     "js", 
     "json", 
     "es6" 
    ], 
    "rootDir": "./app", 
    "collectCoverage": true, 
    "unmockedModulePathPatterns": [ 
     "react", 
     "events", 
     "lodash" 
    ] 
    }, 
    "browserify": { 
    "transform": [ 
     "browserify-shim", 
     [ 
     "reactify", 
     { 
      "es6": true 
     } 
     ] 
    ] 
    }, 
    "browser": { 
    "jquery": "./app/bower_components/jquery/dist/jquery.js" 
    }, 
    "browserify-shim": { 
    "jquery": "$" 
    } 
} 

screen result

관련 문제