8000 test: fix `cliServiceVersion` for generator unit tests · vuejs/vue-cli@aafc83f · GitHub
[go: up one dir, main page]

Skip to content

Commit aafc83f

Browse files
committed
test: fix cliServiceVersion for generator unit tests
(cherry picked from commit 9eadfe1)
1 parent ea91df2 commit aafc83f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/@vue/cli/lib/GeneratorAPI.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ class GeneratorAPI {
9696
}
9797

9898
get cliServiceVersion () {
99+
// In generator unit tests, we don't write the actual file back to the disk.
100+
// So there is no cli-service module to load.
101+
// In that case, just return the cli version.
102+
if (process.env.VUE_CLI_TEST && process.env.VUE_CLI_SKIP_WRITE) {
103+
return this.cliVersion
104+
}
105+
99106
const servicePkg = loadModule(
100107
'@vue/cli-service/package.json',
101108
this.generator.context

0 commit comments

Comments
 (0)
0