Skip to content

Commit 59209bc

Browse files
committed
test: adjust test script
1 parent 8ce1c55 commit 59209bc

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/CONTRIBUTING.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,28 @@ yarn serve
2222

2323
### Testing Tips
2424

25-
The full test suite is rather slow, because it has a number of e2e tests that perform full webpack builds of actual projects. To narrow down the tests needed to run during development, you can pass a list of packages to the `test` script:
25+
The full test suite is rather slow, because it has a number of e2e tests that perform full webpack builds of actual projects. To narrow down the tests needed to run during development, you can pass the test script a regex to match test filenames:
2626

2727
``` sh
28-
yarn test cli cli-services
28+
yarn test <filenameRegex>
2929
```
3030

31-
If the package is a plugin, you can ommit the `cli-plugin-` prefix:
31+
Note the regex matches against full paths relative to the project root, so for example if you want to test all the prompt modules in `packages/@vue/cli/lib/promptModules`, you can simply run:
32+
33+
``` sh
34+
yarn test promptModules
35+
```
36+
37+
Alternatively, you can run the tests inside specific packages with the `-p` flag:
3238

3339
``` sh
34-
yarn test typescript
40+
yarn test -p cli,cli-service
3541
```
3642

37-
To further narrow down tests, you can also specify your own regex:
43+
If the package is a plugin, you can ommit the `cli-plugin-` prefix:
3844

3945
``` sh
40-
yarn test -g <filenameRegex>
46+
yarn test -p typescript
4147
```
4248

4349
You can also pass `--watch` to run tests in watch mode.

scripts/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ const minimist = require('minimist')
33

44
const args = minimist(process.argv.slice(2))
55

6-
const packages = args._
7-
let regex = args.g || args.grep
8-
if (!regex && packages.length) {
9-
regex = `.*@vue/(${packages.join('|')}|cli-plugin-(${packages.join('|')}))/.*\\.spec\\.js$`
6+
let regex = args._[0]
7+
if (args.p || args.package) {
8+
const packages = (args.p || args.package).split(',').join('|')
9+
regex = `.*@vue/(${packages}|cli-plugin-(${packages}))/.*\\.spec\\.js$`
1010
}
1111

1212
;(async () => {

0 commit comments

Comments
 (0)