Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(front-end): fix jest install #408

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/potassium/recipes/front_end.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -107,8 +107,10 @@ 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"
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)
Expand Down Expand Up @@ -239,6 +241,9 @@ def jest_config
"moduleNameMapper": {
"^@/(.*)$": "app/javascript/$1"
},
"testEnvironmentOptions": {
"customExportConditions": ["node", "node-addons"]
},
"moduleFileExtensions": [
"js",
"ts",
Expand Down
8 changes: 4 additions & 4 deletions lib/potassium/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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