hobos / baosuzhai

抱素小书屋,孜孜不倦,我的中国梦!
www.zizibujuan.com
2 stars 0 forks source link

Travis-ci使用心得 #155

Closed xiaohulu closed 10 years ago

xiaohulu commented 10 years ago

Travis-ci使用心得

坚持整理

Travis-ci运行intern测试用例

Intern可以在nodejs下运行测试用例,OSGi客户端项目结构的约定是所有的项目都放在static目录下,但是使用npm安装intern后,会将intern放在node_modules目录下面,最后目录结构为

开发环境的项目结构

root
        static
                dojo
                node_modules(不提交到远程仓库)
                        intern
                my_client_module

因为node_modules没有提交到远程仓库,所以需要Travis-ci使用npm安装依赖,也就是intern(对npm命令还不熟悉)。但是Travis-ci会将node_modules安装在root下面,这样开发环境和集成测试环境的目录结构就不一样了,也就是在开发环境下可以使用的intern配置信息,在集成测试环境下无法使用了。

集成测试环境的项目结构

root
        node_modules
        static
                dojo
                node_modules(符号连接)
                        intern
                my_client_module

本想cd到static下,再安装intern,但是intern依然被安装在root目录下。后来使用符号连接的方式,在static下建立一个指向root/node_modules的符号连接,也就是windows中说的快捷方式,cd到static目录结构下,运行以下代码建立符号连接

- ln -s ../node_modules node_modules