Skip to content

Commit e4ff22a

Browse files
committed
test: fix vue.config.js test for appveyor
1 parent 3489e4d commit e4ff22a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/@vue/cli-service/__tests__/Service.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ test('load project options from package.json', () => {
5353
})
5454

5555
test('load project options from vue.config.js', () => {
56+
process.env.VUE_CLI_SERVICE_CONFIG_PATH = `/vue.config.js`
5657
fs.writeFileSync('/vue.config.js', `module.exports = { lintOnSave: false }`)
5758
mockPkg({
5859
vue: {
@@ -61,6 +62,7 @@ test('load project options from vue.config.js', () => {
6162
})
6263
const service = createMockService()
6364
fs.unlinkSync('/vue.config.js')
65+
delete process.env.VUE_CLI_SERVICE_CONFIG_PATH
6466
// vue.config.js has higher priority
6567
expect(service.projectOptions.lintOnSave).toBe(false)
6668
})

packages/@vue/cli-service/lib/Service.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,13 @@ module.exports = class Service {
159159
loadProjectOptions (inlineOptions) {
160160
// vue.config.js
161161
let fileConfig, pkgConfig, resolved, resovledFrom
162-
const configPath = path.resolve(this.context, 'vue.config.js')
162+
const configPath = (
163+
process.env.VUE_CLI_SERVICE_CONFIG_PATH ||
164+
path.resolve(this.context, 'vue.config.js')
165+
)
163166
if (fs.existsSync(configPath)) {
164167
try {
165168
fileConfig = require(configPath)
166-
console.log(fileConfig)
167169
if (!fileConfig || typeof fileConfig !== 'object') {
168170
error(
169171
`Error loading ${chalk.bold('vue.config.js')}: should export an object.`

0 commit comments

Comments
 (0)