Skip to content

Commit eeb1491

Browse files
committed
test: use offline install for test projects (for vue upgrade)
1 parent 170e63e commit eeb1491

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.circleci/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,16 @@ jobs:
5252
at: ~/
5353
- run: yarn lint-without-fix
5454
- run: yarn check-links
55+
- restore_cache:
56+
keys:
57+
# TODO: should use a more accurate cache key
58+
- v2-vue-cli-offline-{{ .Branch }}-{{ checksum "yarn.lock" }}
59+
- run: yarn config set yarn-offline-mirror ~/npm-packages-offline-cache
5560
- run: yarn test -p cli-service-global,eslint,pwa,babel,babel-preset-app,vuex,router
61+
- save_cache:
62+
key: v2-vue-cli-offline-{{ .Branch }}-{{ checksum "yarn.lock" }}
63+
paths:
64+
- ~/npm-packages-offline-cache
5665

5766
group-4:
5867
<<: *defaults

appveyor.yml

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

1718
cache:
1819
- node_modules -> appveyor.yml, **\package.json, yarn.lock
1920
- '%LOCALAPPDATA%\Yarn -> appveyor.yml, **\package.json, yarn.lock'
21+
- npm-packages-offline-cache -> appveyor.yml, **\package.json, yarn.lock
2022

2123
build: off
2224

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ class PackageManager {
241241
}
242242

243243
async install () {
244+
if (process.env.VUE_CLI_TEST) {
245+
try {
246+
return this.runCommand([PACKAGE_MANAGER_CONFIG[this.bin].install, '--offline'])
247+
} catch (e) {
248+
this.runCommand([PACKAGE_MANAGER_CONFIG[this.bin].install])
249+
}
250+
}
251+
244252
return this.runCommand([PACKAGE_MANAGER_CONFIG[this.bin].install])
245253
}
246254

0 commit comments

Comments
 (0)