mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-23 21:40:00 -05:00
refactor: change default test directory name to "tests"
BREAKING CHANGE: all tests are now located in "tests" instead of "test" close #877
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"pluginsFile": "test/e2e/plugins/index.js"
|
||||
"pluginsFile": "tests/e2e/plugins/index.js"
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// https://docs.cypress.io/guides/guides/plugins-guide.html
|
||||
|
||||
module.exports = (on, config) => {
|
||||
return Object.assign({}, config, {
|
||||
fixturesFolder: 'test/e2e/fixtures',
|
||||
integrationFolder: 'test/e2e/specs',
|
||||
screenshotsFolder: 'test/e2e/screenshots',
|
||||
videosFolder: 'test/e2e/videos',
|
||||
supportFile: 'test/e2e/support/index.js'
|
||||
})
|
||||
}
|
||||
@@ -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'
|
||||
})
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = {
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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>`
|
||||
|
||||
@@ -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)`)
|
||||
})
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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)`)
|
||||
})
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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`
|
||||
])
|
||||
]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user