AngularJs開發環境搭建

1. 安裝Sublime Text3

經常使用插件安裝:AngularJs, Autoprefixer, BracketHighlighter,ConvertToUTF8,CSScomb,DocBlockr,Emmet,Git,GitGutter,Jquery,JsFormat,SideBarEnhancements,SublimeCodeIntel,SublimeLinter(jshint,csslint),Tag,Terminal,TrailingSpaces

其中SublimeLinter須要用到NodeJs,並安裝jshint和csslint, npm install -g jshint
javascript

2. 安裝Bower依賴css

安裝好Bower後,經過bower install 安裝angularjs  bootstrap java

3. 搭建單元測試環境angularjs

karma 單元測試容器
npm

karma-jasmine 編寫單元測試
bootstrap

karma-coverage 代碼覆蓋率
瀏覽器

karma-firefox-launcher 
bash

初始化配置文件 karma init框架

Which testing framework do you want to use ?

Press tab to list possible options. Enter to move to the next question.

> jasmine

注:測試框架選擇

Do you want to use Require.js ?

This will add Require.js plugin.

Press tab to list possible options. Enter to move to the next question.

> yes

注:需不須要引入requirejs

引入requirejs的緣由:加載相互依賴的js文件

Do you want to capture a browser automatically ?

Press tab to list possible options. Enter empty string to move to the next question.

> Chrome

> 

注:選擇打開的瀏覽器

What is the location of your source and test files ?

You can use glob patterns, eg. "js/*.js" or "test/**/*Spec.js".

Enter empty string to move to the next question.

> 

注:karma啓動時加載的目標文件和測試文件

Should any of the files included by the previous patterns be excluded ?

You can use glob patterns, eg. "**/*.swp".

Enter empty string to move to the next question.

> 

注:加載的目標文件不須要測試的文件

Do you want Karma to watch all the files and run the tests on change ?

Press tab to list possible options.

> yes

注:karma要不要動態監聽目標文件和測試用例變化

Config file generated at "D:\workspace\javascript\karma\karma.conf.js".

這個指令跑完後你就會發現目錄底下多了個配置文件karma.conf.js,test-main.js

karma.conf.js:  karma配置文件

test-main.js:    requireJS配置文件

 運行測試用例  karma startide

4. 搭建集成測試環境

 Protractor

待續。。。

相關文章
相關標籤/搜索