From 3d833a834e5e005f72815432456afafb0023ff44 Mon Sep 17 00:00:00 2001 From: Guillermo Moreno Date: Fri, 8 Jul 2022 15:52:45 -0400 Subject: [PATCH 1/2] fix(front-end): fix jest install --- lib/potassium/recipes/front_end.rb | 10 +++++++--- lib/potassium/version.rb | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/potassium/recipes/front_end.rb b/lib/potassium/recipes/front_end.rb index 7f283daa..caeda145 100644 --- a/lib/potassium/recipes/front_end.rb +++ b/lib/potassium/recipes/front_end.rb @@ -5,7 +5,7 @@ class Recipes::FrontEnd < Rails::AppBuilder POSTCSS_VERSION = Potassium::POSTCSS_VERSION TAILWINDCSS_VERSION = Potassium::TAILWINDCSS_VERSION AUTOPREFIXER_VERSION = Potassium::AUTOPREFIXER_VERSION - VUE_JEST_VERSION = Potassium::VUE_JEST_VERSION + JEST_VERSION = Potassium::JEST_VERSION def ask frameworks = { @@ -107,8 +107,9 @@ def setup_tailwind end def setup_jest - run "bin/yarn add jest @vue/vue3-jest@#{VUE_JEST_VERSION} babel-jest "\ - "@vue/test-utils@#{VUE_TEST_UTILS_VERSION} ts-jest" + run "bin/yarn add jest@#{JEST_VERSION} @vue/vue3-jest@#{JEST_VERSION} "\ + "babel-jest@#{JEST_VERSION} @vue/test-utils@#{VUE_TEST_UTILS_VERSION} ts-jest@#{JEST_VERSION} "\ + "jest-environment-jsdom@#{JEST_VERSION} --dev" json_file = File.read(Pathname.new("package.json")) js_package = JSON.parse(json_file) js_package = js_package.merge(jest_config) @@ -239,6 +240,9 @@ def jest_config "moduleNameMapper": { "^@/(.*)$": "app/javascript/$1" }, + "testEnvironmentOptions": { + "customExportConditions": ["node", "node-addons"] + }, "moduleFileExtensions": [ "js", "ts", diff --git a/lib/potassium/version.rb b/lib/potassium/version.rb index b41df5d9..6059d295 100644 --- a/lib/potassium/version.rb +++ b/lib/potassium/version.rb @@ -10,8 +10,8 @@ module Potassium TAILWINDCSS_VERSION = "^3" POSTCSS_VERSION = "^8" AUTOPREFIXER_VERSION = "^10" - VUE_VERSION = "^3" - VUE_LOADER_VERSION = "^16" - VUE_TEST_UTILS_VERSION = "^2.0.0-rc.18" - VUE_JEST_VERSION = "^27.0.0-alpha.1" + VUE_VERSION = "^3.2.33" + VUE_LOADER_VERSION = "^16.8.3" + VUE_TEST_UTILS_VERSION = "^2.0.2" + JEST_VERSION = "^28.0.1" end From 87bdff0d25a4f375b64e964d66681d027d73f3e9 Mon Sep 17 00:00:00 2001 From: Guillermo Moreno Date: Tue, 26 Jul 2022 15:26:40 -0400 Subject: [PATCH 2/2] fix(jest): add @types/jest to dependencies --- lib/potassium/recipes/front_end.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/potassium/recipes/front_end.rb b/lib/potassium/recipes/front_end.rb index caeda145..57b3acdb 100644 --- a/lib/potassium/recipes/front_end.rb +++ b/lib/potassium/recipes/front_end.rb @@ -110,6 +110,7 @@ def setup_jest run "bin/yarn add jest@#{JEST_VERSION} @vue/vue3-jest@#{JEST_VERSION} "\ "babel-jest@#{JEST_VERSION} @vue/test-utils@#{VUE_TEST_UTILS_VERSION} ts-jest@#{JEST_VERSION} "\ "jest-environment-jsdom@#{JEST_VERSION} --dev" + run "bin/yarn add @types/jest@#{JEST_VERSION}" json_file = File.read(Pathname.new("package.json")) js_package = JSON.parse(json_file) js_package = js_package.merge(jest_config)