[英]How to run single file test in quasar testing
I have test code to run in quasar project, but dont want to run all tests.我有要在 quasar 项目中运行的测试代码,但不想运行所有测试。 so I tried several below commands, still run all test files.所以我尝试了以下几个命令,仍然运行所有测试文件。
quasar test --unit jest -t "demo/demo.spec.js"
quasar test --unit jest --spec "demo/demo.spec.js"
quasar test --unit jest -i "demo/demo.spec.js"
what do I have to do?我需要做什么?
You can skip Quasar CLI and use the scripts available in package.json.您可以跳过 Quasar CLI 并使用 package.json 中提供的脚本。
npm run test:unit test/jest/__tests__/App.spec.js
A better approach for a quicker test and develop process would be using the test:unit:watch
script then filtering for a filename pattern.更快的测试和开发过程的更好方法是使用test:unit:watch
脚本,然后过滤文件名模式。
npm run test:unit:watch
#press p, then type the desired file pattern
you can use jest command to test files you are targeting with regex.您可以使用 jest 命令来测试您使用正则表达式定位的文件。
quasar doesn't have any simgle file test, it will test all files with any cmd. quasar 没有任何单一文件测试,它将使用任何 cmd 测试所有文件。
The word after -i doesn't mean file name, but it is regex pattern meaning "/demo/i" -i 后面的单词不是文件名,而是正则表达式,意思是“/demo/i”
jest -i demo
You can also test separate files using the Majestic UI plugin, which you can select as an option when installing jest.您还可以使用 Majestic UI 插件测试单独的文件,您可以在安装 jest 时选择该插件作为选项。
Start Majestic with the command npm run test:unit:ui
which will open a localhost testing UI and from there you can test each file individually.使用命令npm run test:unit:ui
启动 Majestic,这将打开本地主机测试 UI,然后您可以单独测试每个文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.