Skip to content

Commit

Permalink
test: adjust test script
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 30, 2018
1 parent 8ce1c55 commit 59209bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
18 changes: 12 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,28 @@ yarn serve

### Testing Tips

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:
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:

``` sh
yarn test cli cli-services
yarn test <filenameRegex>
```

If the package is a plugin, you can ommit the `cli-plugin-` prefix:
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:

``` sh
yarn test promptModules
```

Alternatively, you can run the tests inside specific packages with the `-p` flag:

``` sh
yarn test typescript
yarn test -p cli,cli-service
```

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

``` sh
yarn test -g <filenameRegex>
yarn test -p typescript
```

You can also pass `--watch` to run tests in watch mode.
Expand Down
8 changes: 4 additions & 4 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const minimist = require('minimist')

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

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

;(async () => {
Expand Down

0 comments on commit 59209bc

Please sign in to comment.