jsinspect学习笔记

580 阅读1分钟
  • nodejs:13.10.0
  • jsinspect:0.12.7

用法踩坑

No .js .jsx files found in the list of paths错误

局部安装完毕后,执行npx jsinspect test/jsinspect/target/,控制台报No .js .jsx files found in the list of paths。target文件夹下有两个文件,分别是file.js、file2.js,单独执行npx jsinspect test/jsinspect/target/会提示找不到文件,但运行npx jsinspect test/jsinspect/target/file1.js -t 5可以得到正确的结果。

在源代码里全局搜索No .js .jsx files found in the list of paths没结果,改用in the list of paths搜索,可以定位到jsinspect#L88。进而发现在执行filepaths.getSync有个ignore参数,打印发现是[ 'node_modules', 'bower_components', 'test', 'spec' ],而我们的路径里又恰好有test,看来是被忽略了,而且因为默认数据是被硬编码到源码里的jsinspect#L71,且无法覆盖,所以只能通过更改文件夹名称的方式使用。

输出结果无html形式,不直观

不支持vue,只支持js、jsx

底层语法解析用的是babylon@6.16.1,不支持vue