Skip to content

Commit

Permalink
test: fix mock module in upgrader test
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Jan 27, 2020
1 parent 51cdebd commit c615110
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/@vue/cli-shared-utils/lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ exports.resolveModule = function (request, context) {
}

exports.loadModule = function (request, context, force = false) {
// createRequire doesn't work with jest mock modules (which we used in migrator, for inquirer)
if (process.env.VUE_CLI_TEST && request.endsWith('migrator')) {
return require(request)
}

try {
return createRequire(path.resolve(context, 'package.json'))(request)
} catch (e) {
Expand Down

0 comments on commit c615110

Please sign in to comment.