Skip to content

Commit bce4b18

Browse files
Wrap update_files calls in conditionals (#147)
Co-authored-by: Grant Petersen-Speelman <[email protected]>
1 parent 92ed2fd commit bce4b18

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
### Changed
44
* Removed the update generator and reduced options for install generator [PR 149](https://github.com/shakacode/cypress-on-rails/pull/149)
55

6+
### Fixed
7+
* fix update index.js in install generatpr [PR 147](https://github.com/shakacode/cypress-on-rails/pull/147) by [Judahmeek]
8+
69
## [1.16.0]
710
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.15.1...v1.16.0
811

lib/generators/cypress_on_rails/install_generator.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ def add_initial_files
5555
end
5656

5757
def update_files
58-
append_to_file "#{options.cypress_folder}/support/index.js",
59-
"\nimport './on-rails'",
60-
after: 'import \'./commands\''
61-
append_to_file "#{options.playwright_folder}/support/index.js",
62-
"\nimport './on-rails'",
63-
after: '// Import commands.js using ES2015 syntax:'
58+
if options.framework == 'cypress'
59+
append_to_file "#{options.install_folder}/cypress/support/index.js",
60+
"\nimport './on-rails'",
61+
after: 'import \'./commands\''
62+
end
63+
if options.framework == 'playwright'
64+
append_to_file "#{options.install_folder}/playwright/support/index.js",
65+
"\nimport './on-rails'",
66+
after: '// Import commands.js using ES2015 syntax:'
67+
end
6468
end
6569
end
6670
end

0 commit comments

Comments
 (0)