Lidemy / mentor-program-2nd-futianshen

mentor-program-2nd-futianshen created by GitHub Classroom
14 stars 2 forks source link

hw2 #5

Closed futianshen closed 6 years ago

futianshen commented 6 years ago

@aszx87410 原本想在繳交作業的資料夾 week2 下面用 jest 做測試,但是一直出現失敗訊息

Test suite failed to run Couldn't find preset "es2015" relative to directory "/Users/futianshen/Desktop/mentor-program-2nd-futianshen"

不過將資料夾中的作業和測試檔案複製到桌面上新開資料夾後就可以測試了,我的操作如下,不知道是不是我的步驟有問題?

  1. cd /Users/futianshen/Desktop/mentor-program-2nd-futianshen/homeworks/week2 (到目標資料夾)
  2. npm init
  3. npm install --save-dev jest
  4. npx jest hw1.test.js

另外想問每開一個新的資料夾(專案) jest 都要重新安裝嗎?

aszx87410 commented 6 years ago

@futianshen 是,你方法錯了 你跑 test 的時候要在「根目錄」下而不是在那個資料夾,而且該放的東西我都放了,你只要安裝跟跑指令就好

  1. cd /Users/futianshen/Desktop/mentor-program-2nd-futianshen
  2. npm install
  3. npx jest homeworks/week2 /hw1.test.js

另外,恭喜完成作業二!

futianshen commented 6 years ago

謝謝,辛苦了!