Skip to content

Commit

Permalink
refactor: change default test directory name to "tests"
Browse files Browse the repository at this point in the history
BREAKING CHANGE: all tests are now located in "tests" instead of "test"
close #877
  • Loading branch information
yyx990803 committed Feb 28, 2018
1 parent 88726a3 commit 64b4515
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-e2e-cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Cypress offers a rich interactive interface for running E2E tests, but currently

## Configuration

We've pre-configured Cypress to place most of the e2e testing related files under `<projectRoot>/test/e2e`. You can also check out [how to configure Cypress via `cypress.json`](https://docs.cypress.io/guides/references/configuration.html#Options).
We've pre-configured Cypress to place most of the e2e testing related files under `<projectRoot>/tests/e2e`. You can also check out [how to configure Cypress via `cypress.json`](https://docs.cypress.io/guides/references/configuration.html#Options).

## Installing in an Already Created Project

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"pluginsFile": "test/e2e/plugins/index.js"
"pluginsFile": "tests/e2e/plugins/index.js"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// https://docs.cypress.io/guides/guides/plugins-guide.html

module.exports = (on, config) => {
return Object.assign({}, config, {
fixturesFolder: 'tests/e2e/fixtures',
integrationFolder: 'tests/e2e/specs',
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
supportFile: 'tests/e2e/support/index.js'
})
}
6 changes: 3 additions & 3 deletions packages/@vue/cli-plugin-e2e-nightwatch/nightwatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const deepmerge = require('deepmerge')
const userOptions = JSON.parse(process.env.VUE_NIGHTWATCH_USER_OPTIONS || '{}')

module.exports = deepmerge({
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
src_folders: ['tests/e2e/specs'],
output_folder: 'tests/e2e/reports',
custom_assertions_path: ['tests/e2e/custom-assertions'],

selenium: {
start_process: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/@vue/cli-plugin-eslint/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = (api, { config, lintOn = [] }) => {
}
}
api.render(files => {
files['test/unit/.eslintrc'] = JSON.stringify(config, null, 2)
files['tests/unit/.eslintrc'] = JSON.stringify(config, null, 2)
})
} else if (api.hasPlugin('unit-jest')) {
const config = {
Expand All @@ -85,7 +85,7 @@ module.exports = (api, { config, lintOn = [] }) => {
}
}
api.render(files => {
files['test/unit/.eslintrc'] = JSON.stringify(config, null, 2)
files['tests/unit/.eslintrc'] = JSON.stringify(config, null, 2)
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-unit-jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Run unit tests with Jest. Default files matches are:

- Any files in `test/unit` that end in `.spec.(js|ts)`;
- Any files in `tests/unit` that end in `.spec.(js|ts)`;
- Any js/ts files inside `__tests__` directories.

Usage: `vue-cli-service test [options] <regexForTestFiles>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ test('base', async () => {
expect(pkg.scripts.test).toBeTruthy()
expect(pkg.devDependencies).toHaveProperty('@vue/test-utils')
expect(pkg.devDependencies).toHaveProperty('babel-jest')
expect(files['test/unit/.eslintrc']).toMatch('"jest": true')
expect(files['tests/unit/.eslintrc']).toMatch('"jest": true')

const spec = files['test/unit/HelloWorld.spec.js']
const spec = files['tests/unit/HelloWorld.spec.js']
expect(spec).toMatch(`expect(wrapper.text()).toMatch(msg)`)
})
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-unit-jest/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = api => {

if (api.hasPlugin('eslint')) {
api.render(files => {
files['test/unit/.eslintrc'] = JSON.stringify({
files['tests/unit/.eslintrc'] = JSON.stringify({
env: { jest: true },
rules: {
'import/no-extraneous-dependencies': 'off'
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-unit-jest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = api => {

let testMatch = []
if (!args._.length) {
testMatch = [`--testMatch`, `<rootDir>/(test/unit/**/*.spec.(ts|tsx|js)|**/__tests__/*.(ts|tsx|js))`]
testMatch = [`--testMatch`, `<rootDir>/(tests/unit/**/*.spec.(ts|tsx|js)|**/__tests__/*.(ts|tsx|js))`]
}

const argv = [
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-unit-mocha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
--include include the given module into test bundle
```

Default files matches are: any files in `test/unit` that end in `.spec.(ts|js)`.
Default files matches are: any files in `tests/unit` that end in `.spec.(ts|js)`.

All [mocha-webpack command line options](http://zinserjan.github.io/mocha-webpack/docs/installation/cli-usage.html) are also supported.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ test('base', async () => {

expect(pkg.scripts.test).toBeTruthy()
expect(pkg.devDependencies).toHaveProperty('@vue/test-utils')
expect(files['test/unit/.eslintrc']).toMatch('"mocha": true')
expect(files['tests/unit/.eslintrc']).toMatch('"mocha": true')

const spec = files['test/unit/HelloWorld.spec.js']
const spec = files['tests/unit/HelloWorld.spec.js']
expect(spec).toMatch(`import { expect } from 'chai'`)
expect(spec).toMatch(`expect(wrapper.text()).to.include(msg)`)
})
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-unit-mocha/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = api => {

if (api.hasPlugin('eslint')) {
api.render(files => {
files['test/unit/.eslintrc'] = JSON.stringify({
files['tests/unit/.eslintrc'] = JSON.stringify({
env: { mocha: true },
rules: {
'import/no-extraneous-dependencies': 'off'
Expand Down
4 changes: 2 additions & 2 deletions packages/@vue/cli-plugin-unit-mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ module.exports = api => {
...rawArgv,
...(hasInlineFilesGlob ? [] : [
api.hasPlugin('typescript')
? `test/unit/**/*.spec.ts`
: `test/unit/**/*.spec.js`
? `tests/unit/**/*.spec.ts`
: `tests/unit/**/*.spec.js`
])
]

Expand Down
6 changes: 3 additions & 3 deletions packages/@vue/cli-service/generator/template/_gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ node_modules
/dist
<%_ if (rootOptions.plugins && rootOptions.plugins['@vue/cli-plugin-e2e-nightwatch']) { _%>

/test/e2e/reports/
/tests/e2e/reports/
selenium-debug.log
<%_ } _%>
<%_ if (rootOptions.plugins && rootOptions.plugins['@vue/cli-plugin-e2e-cypress']) { _%>

/test/e2e/videos/
/test/e2e/screenshots/
/tests/e2e/videos/
/tests/e2e/screenshots/
<%_ } _%>

# local env files
Expand Down

0 comments on commit 64b4515

Please sign in to comment.