mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-29 16:30:33 -05:00
test: simplify loadModule special case handling for tests
1. createRequire should have been properly handled in newer Jest versions: https://github.com/facebook/jest/pull/9469 2. We don't test migrators with Jest mock modules anymore So it's safe to skip that condition
This commit is contained in:
@@ -62,10 +62,9 @@ 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, and in tests for cli-service)
|
||||
// TODO: it's supported in Jest 25
|
||||
if (process.env.VUE_CLI_TEST && (request.endsWith('migrator') || context === '/')) {
|
||||
// createRequire doesn't work with jest mocked fs
|
||||
// (which we used in tests for cli-service)
|
||||
if (process.env.VUE_CLI_TEST && context === '/') {
|
||||
return require(request)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user