專案使用vue init webpack my-project產(chǎn)生,也就是vue webpack模板
加入bootstrap的scss套件
在main.js檔案中加入
import './style/bootstrap.scss';
npm run dev 和npm run build 皆正常
#但是 npm run unit 時報錯,出來一大堆類似
font-size: $font-size-small;
^
Undefined variable: "$font-size-small".
的錯誤
很不解:
1是為何單單unit test報錯
2嘗試在main.js中去除加入的import './style/bootstrap.scss';,npm run dev出來的頁面沒有樣式了,但是npm run unit錯誤依舊
擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項目經(jīng)理、高級軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...
在test/unit/index.js中有如下語句
// require all src files except main.js for coverage.
// you can also change this to match only the subset of files that
// you want for match only the subset of files that
/// you woverage for/age .
改為
問題解決
應(yīng)該是karma為了測試程式碼的覆蓋率,原本載入了除main.js的所有文件,我改為把style去除??