2018-06-14 作测试

2018.6.14 培训学习任务 - 代码风格质量与测试

获取fullstack-training最新代码。

fullstack-training下执行 $ npm install

运行 $ npm run lint

会发现控制台输出你们代码的错误写法。凡是error(红色的)都要改好。黄色的警告也尽量改掉。

以上报错是因为我们启用了eslint 检测。请看根目录下有 .eslintrc,.eslintignore这两个配置文件。更多请看eslint

学习Mocha,中文文档自己找。

测试框架 Mocha 实例教程

自已写几个通方法,然后用 Mocha 写测试用例,并运行测试。



一路的错误

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\06-11lunbo\js\js.js

  13:32  warning  Expected '===' and instead saw '=='  eqeqeq

  23:19  warning  Missing radix parameter              radix

  30:25  warning  Missing radix parameter              radix

  30:79  warning  Missing radix parameter              radix

  31:30  warning  Missing radix parameter              radix

  60:15  warning  Expected '===' and instead saw '=='  eqeqeq

  71:15  warning  Expected '===' and instead saw '=='  eqeqeq

  84:26  error    Don't make functions within a loop  no-loop-func

  86:26  warning  Expected '===' and instead saw '=='  eqeqeq

  90:21  warning  Missing radix parameter              radix

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\06-11lunbo\slider2\js\index_banner.js

  76:21  warning  Expected '===' and instead saw '=='  eqeqeq

  85:18  error    Infix operators must be spaced      space-infix-ops

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\form\js\countdown.js

  15:7  warning  Unexpected console statement  no-console

  18:11  warning  Unexpected console statement  no-console

  28:7  warning  Unexpected console statement  no-console

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\form\js\table.js

  29:7  warning  Unexpected console statement  no-console

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\form\js\userList.js

  6:9  warning  '_this' is assigned a value but never used        no-unused-vars

  19:29  warning  Identifier 'c_userObj' is not in camel case        camelcase

  24:11  error    Irregular whitespace not allowed                  no-irregular-whitespace

  25:28  warning  Identifier 'd_userObj' is not in camel case        camelcase

  27:32  warning  Expected '===' and instead saw '=='                eqeqeq

  27:72  warning  Expected '===' and instead saw '=='                eqeqeq

  36:33  error    'userList' is already declared in the upper scope  no-shadow

  44:11  warning  '_data' is assigned a value but never used        no-unused-vars

  45:11  warning  'url' is assigned a value but never used          no-unused-vars

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\gulp-study\src\carousel.js

  88:21  warning  Expected '===' and instead saw '=='  eqeqeq

  90:7  error    Unary operator '--' used            no-plusplus

  97:7  error    Unary operator '++' used            no-plusplus

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\js\countdown.js

  19:7  warning  Unexpected console statement                                    no-console

  20:7  warning  All 'var' declarations must be at the top of the function scope  vars-on-top

  20:7  error    Unexpected var, use let or const instead                        no-var

  22:11  warning  Unexpected console statement                                    no-console

  33:7  warning  Unexpected console statement                                    no-console

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\js\cut.js

  2:22  warning  'require' is defined but never used  no-unused-vars

  10:11  warning  Unexpected console statement        no-console

  21:7  warning  Unexpected console statement        no-console

C:\Users\yubhb\github\fullstack-training\dev\chenxiangyan\slider2\js\index_banner.js

  76:21  warning  Expected '===' and instead saw '=='  eqeqeq

  78:18  error    Infix operators must be spaced      space-infix-ops

  85:18  error    Infix operators must be spaced      space-infix-ops








上午测试安装文件的时候出现的BUG

李伟(李伟_h

怎么找不到文件,上面一大串


Alex(Alex)

特别关注

npm install正常么

_h

李伟(李伟_h)

不正常,报的这个错误就是

_h

Alex(Alex)

特别关注

删掉node_modules重新npm install

_h

李伟(李伟_h)

好的

_h


感觉还是这个问题


我的执行 npm install的时候也出现报错,npm 找不到文件


Alex(Alex)

特别关注

09:47

package.json的内容是啥


Alex(Alex)

特别关注

我先看一下

_h

李伟(李伟_h)

Al

Alex(Alex)

特别关注

先装npm install cnpm -g

然后cnpm install

今天 10:04

Al

Alex(Alex)

特别关注

不用npm。npm取国内包好像有问题

李伟(李伟_h)


Alex(Alex)

特别关注

记住里面的内容,你没权限运行

_h

李伟(李伟_h)

那就前面加sudo??

Al

Alex(Alex)

特别关注

Mac sudo,Windows管理员身份


                                我的执行是这样,然后执行npm run lint


里面的error就是要你们改的

每个JS都列有

今天 10:17

Al

Alex(Alex)

特别关注

如 ==要改成===才合规

Al

Alex(Alex)

特别关注

改好执行npm run lint直到没报错为止

先改error再改警告warning

注意优先级


那像我这个第一个样是什么意思?


@陈香艳_h(陈香艳) 回复

Alex(Alex)

特别关注

找到那个文件加上那一行

_h

李伟(李伟_h)

作用百度吗

Al

Alex(Alex)

特别关注

你们进会议室一下

_h

李伟(李伟_h)

好了

香艳


Alex(Alex)

特别关注

linebreak-style: ["error", "windows"]

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,729评论 0 3
  • 前言 最先接触编程的知识是在大学里面,大学里面学了一些基础的知识,c语言,java语言,单片机的汇编语言等;大学毕...
    oceanfive阅读 3,167评论 0 7
  • 起先是因为戴荃的“悟空”,后来是朋友推荐的今何在的《悟空传》,到现在单曲循环音频怪物的“五百年前”,最近跟西游故事...
    一间房阅读 232评论 0 0
  • 姓名:苏建清,公司:南京海大 【日精进打卡第1天】: 【知~学习】 《六项精进》?遍共?遍 《大学》?遍共?遍 死...
    苏建清阅读 2,209评论 2 1
  • 产品设计和流程管理息息相关,所以最近专门看了流程管理的书,这篇是学习笔记,参考曾经在华为和美的工作的人写的书,书名...
    徐薇薇阅读 15,553评论 8 70