简体   繁体   English

如何在类星体测试中运行单文件测试

[英]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.

相关问题 如何在 Playwright + Cucumber 自动化测试框架中运行 single.feature 文件? - How to run a single .feature file in a Playwright + Cucumber automation testing framework? 如何使用 cypressjs 测试类星体组件? - How to test quasar component with cypressjs? 如何在一个文件中同时运行测试套件列表? - How to run a list of test suites in a single file concurrently in jest? 如何使用 Mocha 运行单个测试? - How to run a single test with Mocha? 如何测试 Quasar(作为 Vue CLI 插件)? - How to test Quasar (as Vue CLI plugin)? 使用(substack)磁带模块进行测试时,如何在文件中只运行一个测试? - When using (substack's) Tape module for testing, how do I run only one test in a file? 如何在 CYPRESS 中使用不同的测试数据集运行单个测试 - How to run a single test with a different set of test data in CYPRESS 当我正在测试的文件通过从卸载的 DOM 中抓取一个元素开始时,我如何在 Jest 中运行测试? - How do I run a test in Jest when the file I'm testing starts by grabbing an element from the unloaded DOM? 如何测试单个文件 Vue 组件 - How to test single file Vue components 如何使用测试库在 React 中为单个渲染测试不同类型的测试? - How to test different types of test for a single render in React with testing-library?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM