From 6bb7d6f6da3a7bc66268d63201395380677e77fc Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 16 Nov 2021 20:44:10 -0600 Subject: [PATCH 1/3] Fix the remaining incorrect Ref usages. Update the remaining import statements to use the provided quasar webpack alias. Fix my mistake with the jest configuration. I seem to have mixed the two methods I suggested, instead of only using one. I installed require-json5, but didn't use it. I did intend to use that, rather than adding all of the aliases in jest.config.js, and so that is done here. --- .eslintrc.js | 1 + jest.config.js | 14 +++----- src/components/common/DateTimeInput.vue | 5 ++- src/components/common/Problem.vue | 2 +- .../instructor/ClasslistManager.vue | 2 +- .../AddUsersManually.vue | 2 +- .../ClasslistManagerComponents/EditUsers.vue | 11 +++--- .../LibraryComponents/LibPanelOPL.vue | 13 ++++--- .../instructor/SetDetails/HomeworkSet.vue | 2 +- src/components/instructor/SetDetails/Quiz.vue | 2 +- .../instructor/SetDetails/ReviewSet.vue | 2 +- src/router/routes.ts | 36 +++++++++---------- 12 files changed, 45 insertions(+), 47 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6bce4d3b..607fca8e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -46,6 +46,7 @@ module.exports = { __statics: 'readonly', process: 'readonly' }, + rules: baseRules, overrides: [{ diff --git a/jest.config.js b/jest.config.js index 29137f6f..de9622b8 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,9 @@ /* eslint-env node */ +const { pathsToModuleNameMapper } = require('ts-jest/utils'); +const requireJSON5 = require('require-json5'); +const { compilerOptions } = requireJSON5('./node_modules/@quasar/app/tsconfig-preset.json'); + module.exports = { preset: 'ts-jest', testEnvironment: 'node', @@ -9,14 +13,6 @@ module.exports = { 'diagnostics': true } }, - moduleNameMapper: { - '^src/(.*)$': '/src/$1', - '^app/(.*)$': '/$1', - '^components/(.*)$': '/src/components/$1', - '^layouts/(.*)$': '/src/layouts/$1', - '^pages/(.*)$': '/src/pages/$1', - '^assets/(.*)$': '/src/assets/$1', - '^boot/(.*)$': '/src/boot/$1' - }, + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }), testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', }; diff --git a/src/components/common/DateTimeInput.vue b/src/components/common/DateTimeInput.vue index 2244b6e2..bf2ad99e 100644 --- a/src/components/common/DateTimeInput.vue +++ b/src/components/common/DateTimeInput.vue @@ -29,7 +29,7 @@