Skip to content

Commit f5359bd

Browse files
authored
workflow: test migrator / vue 3 scenarios with verdaccio (#6071)
1 parent fe88b1c commit f5359bd

File tree

18 files changed

+1980
-1038
lines changed

18 files changed

+1980
-1038
lines changed

.circleci/config.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
version: 2
1+
version: 2.1
22

33
defaults: &defaults
44
working_directory: ~/project/vue
55
docker:
6-
- image: vuejs/ci
6+
- image: circleci/node:lts-browsers
7+
8+
aliases:
9+
- &restore-yarn-cache
10+
key: v2-vue-cli-{{ checksum "yarn.lock" }}
11+
12+
- &save-yarn-cache
13+
key: v2-vue-cli-{{ checksum "yarn.lock" }}
14+
paths:
15+
- node_modules/
16+
- ~/.cache
717

818
workflow_filters: &filters
919
filters:
@@ -16,21 +26,22 @@ jobs:
1626
<<: *defaults
1727
steps:
1828
- checkout
19-
- restore_cache:
20-
keys:
21-
- v2-vue-cli-{{ checksum "yarn.lock" }}
29+
- restore_cache: *restore-yarn-cache
2230
- run: yarn --network-timeout 600000
23-
- save_cache:
24-
key: v2-vue-cli-{{ checksum "yarn.lock" }}
25-
paths:
26-
- node_modules/
27-
- ~/.cache
31+
- save_cache: *save-yarn-cache
2832
- persist_to_workspace:
2933
root: ~/
3034
paths:
3135
- project/vue
3236
- .cache/Cypress
3337

38+
e2e:
39+
<<: *defaults
40+
steps:
41+
- attach_workspace:
42+
at: ~/
43+
- run: ./scripts/e2e-test/run-e2e-test.sh
44+
3445
group-1:
3546
<<: *defaults
3647
steps:
@@ -52,16 +63,9 @@ jobs:
5263
at: ~/
5364
- run: yarn lint-without-fix
5465
- run: yarn check-links
55-
- restore_cache:
56-
keys:
57-
# TODO: should use a more accurate cache key
58-
- v2-vue-cli-offline-{{ checksum "yarn.lock" }}
59-
- run: yarn config set yarn-offline-mirror ~/npm-packages-offline-cache
66+
- restore_cache: *restore-yarn-cache
6067
- run: yarn test -p cli-service-global,eslint,pwa,babel,babel-preset-app,vuex,router
61-
- save_cache:
62-
key: v2-vue-cli-offline-{{ checksum "yarn.lock" }}
63-
paths:
64-
- ~/npm-packages-offline-cache
68+
- save_cache: *save-yarn-cache
6569

6670
group-4:
6771
<<: *defaults
@@ -109,3 +113,7 @@ workflows:
109113
<<: *filters
110114
requires:
111115
- install
116+
- e2e:
117+
<<: *filters
118+
requires:
119+
- install

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ test_script:
1010
- git --version
1111
- node --version
1212
- yarn --version
13-
- yarn config set yarn-offline-mirror ./npm-packages-offline-cache
1413
- yarn test
1514
# ui tests temporarily disabled due to Cypress 3.0 issue on windows
1615
# - cd "packages/@vue/cli-ui" && yarn test
1716

1817
cache:
1918
- node_modules -> appveyor.yml, **\package.json, yarn.lock
2019
- '%LOCALAPPDATA%\Yarn -> appveyor.yml, **\package.json, yarn.lock'
21-
- npm-packages-offline-cache -> appveyor.yml, **\package.json, yarn.lock
2220

2321
build: off
2422

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint-without-fix": "eslint packages/**/*.js packages/**/bin/*",
1313
"check-links": "node scripts/checkLinks.js",
1414
"clean": "rimraf packages/test/* packages/**/temp/*",
15+
"clean-e2e": "rimraf /tmp/verdaccio-workspace",
1516
"sync": "node scripts/syncDeps.js",
1617
"boot": "node scripts/bootstrap.js",
1718
"release": "yarn --pure-lockfile && yarn clean && node scripts/release.js",
@@ -56,7 +57,7 @@
5657
"babel-core": "7.0.0-bridge.0",
5758
"babel-eslint": "^10.1.0",
5859
"babel-jest": "^24.9.0",
59-
"chromedriver": "^85.0.0",
60+
"chromedriver": "^87.0.0",
6061
"debug": "^4.1.0",
6162
"eslint": "^6.7.2",
6263
"eslint-plugin-graphql": "^3.1.0",
@@ -84,6 +85,7 @@
8485
"rimraf": "^3.0.2",
8586
"semver": "^7.3.2",
8687
"typescript": "~3.9.3",
88+
"verdaccio": "^4.8.1",
8789
"vuepress": "^1.6.0",
8890
"webpack": "^4.0.0",
8991
"yorkie": "^2.0.0"

packages/@vue/cli-plugin-e2e-nightwatch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"nightwatch": "^1.4.1"
2929
},
3030
"devDependencies": {
31-
"chromedriver": "^85.0.0",
31+
"chromedriver": "^87.0.0",
3232
"geckodriver": "^1.20.0",
3333
"selenium-server": "^3.141.59"
3434
},

packages/@vue/cli-plugin-e2e-webdriverio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
}
5858
},
5959
"devDependencies": {
60-
"chromedriver": "^85.0.0",
60+
"chromedriver": "^87.0.0",
6161
"geckodriver": "^1.20.0",
6262
"ts-node": "^9.0.0",
6363
"wdio-chromedriver-service": "^6.0.4",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
jest.setTimeout(300000)
2+
3+
const createOutside = require('@vue/cli-test-utils/createUpgradableProject')
4+
5+
test('should work with Vue 3', async () => {
6+
const project = await createOutside('unit-jest-vue-3', {
7+
vueVersion: '3',
8+
plugins: {
9+
'@vue/cli-plugin-babel': {},
10+
'@vue/cli-plugin-unit-jest': {}
11+
}
12+
})
13+
const pkg = JSON.parse(await project.read('package.json'))
14+
expect(pkg.devDependencies['@vue/test-utils']).toMatch('^2')
15+
await project.run(`vue-cli-service test:unit`)
16+
})
Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
jest.setTimeout(3000000)
22

33
const create = require('@vue/cli-test-utils/createTestProject')
4-
const createOutside = require('@vue/cli-test-utils/createUpgradableProject')
54

65
test('should work', async () => {
76
const project = await create('unit-mocha', {
@@ -12,30 +11,3 @@ test('should work', async () => {
1211
})
1312
await project.run(`vue-cli-service test:unit`)
1413
})
15-
16-
test('should work with Vue 3', async () => {
17-
const project = await createOutside('unit-mocha-vue-3', {
18-
vueVersion: '3',
19-
plugins: {
20-
'@vue/cli-plugin-babel': {},
21-
'@vue/cli-plugin-unit-mocha': {}
22-
}
23-
})
24-
const pkg = JSON.parse(await project.read('package.json'))
25-
expect(pkg.devDependencies['@vue/test-utils']).toMatch('^2')
26-
await project.run(`vue-cli-service test:unit`)
27-
})
28-
29-
test('should work with Vue 3 + TS', async () => {
30-
const project = await createOutside('unit-mocha-vue-3-ts', {
31-
vueVersion: '3',
32-
plugins: {
33-
'@vue/cli-plugin-babel': {},
34-
'@vue/cli-plugin-typescript': {},
35-
'@vue/cli-plugin-unit-mocha': {}
36-
}
37-
})
38-
const pkg = JSON.parse(await project.read('package.json'))
39-
expect(pkg.devDependencies['@vue/test-utils']).toMatch('^2')
40-
await project.run(`vue-cli-service test:unit`)
41-
})
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
jest.setTimeout(3000000)
2+
const createOutside = require('@vue/cli-test-utils/createUpgradableProject')
3+
4+
test('should work with Vue 3', async () => {
5+
const project = await createOutside('unit-mocha-vue-3', {
6+
vueVersion: '3',
7+
plugins: {
8+
'@vue/cli-plugin-babel': {},
9+
'@vue/cli-plugin-unit-mocha': {}
10+
}
11+
})
12+
const pkg = JSON.parse(await project.read('package.json'))
13+
expect(pkg.devDependencies['@vue/test-utils']).toMatch('^2')
14+
await project.run(`vue-cli-service test:unit`)
15+
})
16+
17+
test('should work with Vue 3 + TS', async () => {
18+
const project = await createOutside('unit-mocha-vue-3-ts', {
19+
vueVersion: '3',
20+
plugins: {
21+
'@vue/cli-plugin-babel': {},
22+
'@vue/cli-plugin-typescript': {},
23+
'@vue/cli-plugin-unit-mocha': {}
24+
}
25+
})
26+
const pkg = JSON.parse(await project.read('package.json'))
27+
expect(pkg.devDependencies['@vue/test-utils']).toMatch('^2')
28+
await project.run(`vue-cli-service test:unit`)
29+
})

packages/@vue/cli/lib/util/ProjectPackageManager.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,17 @@ class PackageManager {
343343
}
344344

345345
async install () {
346+
const args = []
347+
348+
if (this.needsPeerDepsFix) {
349+
args.push('--legacy-peer-deps')
350+
}
351+
346352
if (process.env.VUE_CLI_TEST) {
347-
try {
348-
process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = true
349-
await this.runCommand('install', ['--offline', '--silent', '--no-progress'])
350-
delete process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
351-
} catch (e) {
352-
delete process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
353-
await this.runCommand('install', ['--silent', '--no-progress'])
354-
}
353+
args.push('--silent', '--no-progress')
355354
}
356355

357-
return await this.runCommand('install', this.needsPeerDepsFix ? ['--legacy-peer-deps'] : [])
356+
return await this.runCommand('install', args)
358357
}
359358

360359
async add (packageName, {

scripts/e2e-test/cleanup.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
function cleanup {
4+
echo "Cleaning up."
5+
stopLocalRegistry
6+
7+
if [ -n "$GIT_E2E_SETUP" ]; then
8+
cleanupE2Egit
9+
fi
10+
}
11+
12+
# Error messages are redirected to stderr
13+
function handle_error {
14+
echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2;
15+
cleanup
16+
echo "Exiting with error." 1>&2;
17+
exit 1
18+
}
19+
20+
function handle_exit {
21+
cleanup
22+
echo "Exiting without error." 1>&2;
23+
exit
24+
}
25+
26+
# Exit the script with a helpful error message when any error is encountered
27+
trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR
28+
29+
# Cleanup before exit on any termination signal
30+
trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP

0 commit comments

Comments
 (0)