karma requirejs 加载问题小记
来源:互联网 发布:新疆人 知乎 编辑:程序博客网 时间:2024/04/30 04:06
最近在项目中使用karma,遇到一个坑在这边记录一下。方便日后好找。
Karma 安装
npm install karma --save-dev
npm install karma-jasmine karma-chrome-launcher --save-dev
npm install -g karma-cli
$ karma init karma.conf.jsWhich testing framework do you want to use ?Press tab to list possible options. Enter to move to the next question.> jasmineDo 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.> yesDo 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".Press Enter to move to the next question.[这边需要填写require 需加载的文件,否则会报require module is not defined 或者 adapter is not source map ]> *.js> test/**/*.js>Should any of the files included by the previous patterns be excluded ?You can use glob patterns, eg. "**/*.swp".Press Enter to move to the next question.>Do you wanna generate a bootstrap file for RequireJS?This will generate test-main.js/coffee that configures RequireJS and starts thetests.> yesDo you want Karma to watch all the files and run the tests on change ?Press tab to list possible options.> yesConfig file generated at "/Users/vojta/Code/karma/karma.conf.js".
在test-mian.js中可以写入requirejs中的config配置项alias shim
引用
karma 官网 需翻墙
http://karma-runner.github.io/0.13/plus/requirejs.html
如果文中有什么表述不准确的地方,欢迎大力指正,感谢阅读,欢迎交流!
0 0
- karma requirejs 加载问题小记
- RequireJs小记
- 解决requirejs某文件加载超时问题
- 基于Karma,Jasmine的AngularJS,RequireJS单元测试配置笔记
- karma
- karma
- requirejs data-main加载总是失败的问题
- angularjs karma安装小问题
- RequireJS模块化加载
- RequireJS模块化加载
- requirejs加载css
- Requirejs模块化加载
- requirejs加载vue
- 使用 RequireJS 加载 AngularJS
- RequireJS加载js文件
- requirejs加载文件
- RequireJS模块化加载
- requirejs 配置问题
- 教练技术学习笔记
- Redis线程池及分布式
- 静心的一天
- 在对话框和widget窗口添加菜单
- Dalvik switch语句
- karma requirejs 加载问题小记
- PHP中final类,抽象类,接口结构
- 编写高质量iOS 与OSX 代码的52个有效方法之系统框架
- Android RecyclerView使用详解四
- Two Sum LeetCode OJ
- poj 3281 网络流最大流量
- 专题:如何写测试——Spark
- Null & nil & Nil & NSNull
- XML应用于处理