File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ require "json"
2+ require "test_helper"
3+
4+ class BunInstallerTest < ActiveSupport ::TestCase
5+ include RailsAppHelpers
6+
7+ test "installer for bun" do
8+ with_new_rails_app do
9+ _out , _err = run_command ( "bin/rails" , "javascript:install:bun" )
10+
11+ assert_match "js: bun run build --watch" , File . read ( "Procfile.dev" )
12+
13+ assert_equal File . read ( "#{ __dir__ } /../../lib/install/bun/bun.config.js" ) , File . read ( "bun.config.js" )
14+
15+ JSON . parse ( File . read ( "package.json" ) ) . tap do |package |
16+ assert_equal ( "bun bun.config.js" , package [ "scripts" ] [ "build" ] )
17+ end
18+
19+ if sprockets?
20+ assert_match "//= link_tree ../builds" , File . read ( "app/assets/config/manifest.js" )
21+ end
22+ end
23+ end
24+
25+ test "installer with pre-existing Procfile" do
26+ with_new_rails_app do
27+ File . write ( "Procfile.dev" , "pre: existing\n " )
28+ _out , _err = run_command ( "bin/rails" , "javascript:install:bun" )
29+
30+ assert_equal <<~YAML , File . read ( "Procfile.dev" )
31+ pre: existing
32+ js: bun run build --watch
33+ YAML
34+ end
35+ end
36+ end
You can’t perform that action at this time.
0 commit comments