Commit Graph

56 Commits

Author SHA1 Message Date
Rafael Mendonça França 7ee34d9efb
Enable Rails minitest plugin in our rake tasks 2024-05-23 16:16:37 +00:00
David Heinemeier Hansson 8397eb24da
Remove rollup and test machinery for rails-ujs (#50535)
This leaves only the final compiled targets in place.
2024-01-02 16:49:36 +01:00
zzak 04b0aab872
Use FileUtils.mkdir_p for ujs log directory 2023-04-23 18:58:12 +09:00
Lachlan Sylvester b1bc3a0b20 add explaination of extracting from the ENCODED env var 2022-12-31 23:03:09 +11:00
Lachlan Sylvester 2f42c5810a Use explicit argument lists when spawning the server and tests.
Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2022-12-31 23:03:09 +11:00
Lachlan Sylvester d9e79ce7f4 use Karma as the test runner for the UJS tests 2022-12-31 23:03:09 +11:00
Hartley McGuire 7d116c93cf
Convert rails-ujs to ES2015 modules
Building and linting are setup similar to other packages

Most of the changes are related to converting from sprockets requires to
ESM imports/export. However, there are a few notable changes as well:

- A few methods have been refactored to store the Rails object in a
  closure so that properties on it can be overriden by applications (as
  documented and tested). This also resulted in the "start" module
  getting inlined so that it can use the resulting functions.

- The logic for running Rails.start() automatically had to change
  because Rollup uses a slightly different module format than the
  previous coffeescript bundle. The Rollup bundle does not set
  window.Rails until the end up the bundle, so the condition had to be
  updated and window.Rails had to be set manually to ensure backwards
  compatability with scripts listening to the rails:attachBindings event
2022-07-07 21:52:08 -04:00
Eugene Kenny ee525ff663 Load framework test files in deterministic order
`Dir.glob` doesn't guarantee the order of its results:

https://ruby-doc.org/core-2.6.5/Dir.html#method-c-glob

> Case sensitivity depends on your system (File::FNM_CASEFOLD is
> ignored), as does the order in which the results are returned.

Minitest stores a list of all test cases in the order that they were
defined; it shuffles them before they're run, but doesn't sort them:

https://github.com/seattlerb/minitest/blob/v5.13.0/lib/minitest.rb#L1048
https://github.com/seattlerb/minitest/blob/v5.13.0/lib/minitest.rb#L156

This means that the order in which framework tests run is platform
dependent, and running a test command that failed in CI locally won't
necessarily reproduce the error, even when the same seed is provided.

`Rake::FileList` resolves glob patterns to a sorted list of files:

https://github.com/ruby/rake/blob/v13.0.1/lib/rake/file_list.rb#L408

By using `Rake::FileList` instead of `Dir.glob`, framework tests will
always run in the same order when given the same seed, and reproducing
order dependent CI failures will be easier.
2019-12-16 16:55:06 +00:00
Matthew Draper 287920ca7d Respect ENV variables when finding DBs etc for the test suite
If they're not set we'll still fall back to localhost, but this makes it
possible to run the tests against a remote Postgres / Redis / whatever.
2019-02-06 01:20:06 +10:30
Bart de Water eb5fea40a4 Enable Start/EndWith and RegexpMatch cops
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
2018-07-28 17:37:17 -04:00
Yoshiyuki Hirano 6aaeb8ef10 Improve redundancy in line tasks
* Remove needless concat from actionpack/Rakefile
* Remove neesless File.join from actionview/Rakefile
2018-04-19 23:45:28 +09:00
Xavier Noria d654677973 couple of edits [ci skip]
Legit, but really an excuse to trigger the master hook in the docs server.
2018-04-13 16:39:51 +02:00
Yoshiyuki Hirano a680de702b Use comment instead of desc in actionview's Rakefile
* Seems the desc of Rake::TestTask.new is not displayed
* Use comment instead of desc
2018-04-05 09:22:24 +09:00
Yoshiyuki Hirano ab2e597240 Add :ujs desc to Rakefile in actionview 2018-04-05 09:22:23 +09:00
yuuji.yaginuma 2a6852c6ef Correctly kill the server started with ujs test
`Kernel.#spawn` execute command via the shell if contains shell
metacharacters in the command.
In that case, return value of `spawn` is pid of the shell, not the server.
Therefore, just killing the pid will leave the process of server.

In order to correctly kill the server, send a signal to the process
group, not the process.
2017-11-09 11:34:05 +09:00
yuuji.yaginuma e0b11a2417 Return correct exit status of ujs test
The `Process::Status#to_i` returns the bits in stat. If need exit status,
need to use `#exitstatus`.
Ref: https://ruby-doc.org/core-2.4.0/Process/Status.html#method-i-to_i
2017-10-20 15:08:48 +09:00
Guillermo Iguaran 4dcf12a340 PhantomJS is abandoned, replace it with Selenium/Chrome headless 2017-10-19 11:01:52 -05:00
Kazuhiro NISHIYAMA 7f89d4e8bf Use File::NULL instead of "/dev/null" 2017-07-31 21:58:42 +09:00
Kir Shatrov 424117281e Use frozen string literal in actionview/ 2017-07-24 11:53:43 +03:00
yuuji.yaginuma 968499c740 Remove log directory in test postprocessing
The "log" is directory. So it is necessary to use `FileUtils.rm_rf`.
2017-07-21 07:35:26 +09:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
bogdanvlviv 40bdbce191
Define path with __dir__
".. with __dir__ we can restore order in the Universe." - by @fxn

Related to 5b8738c2df
2017-05-23 00:53:51 +03:00
Koichi ITO 89e097fa46 Suppress `warning: assigned but unused variable - stdout` 2017-05-12 15:37:42 +09:00
Andrew White 56014880a2 Correct typo in component name 2017-03-31 13:25:18 +01:00
Javan Makhmali e0ac3498c6 Restore rails-ujs.js UMD module support 2017-03-30 14:40:39 -04:00
Rafael Mendonça França fe4a5706ac
Test rails-ujs in our travis matrix 2017-02-22 13:49:28 -05:00
Rafael Mendonça França 010e246756
Fix Rubocop violations and fix documentation visibility
Some methods were added to public API in
5b14129d8d and they should be not part of
the public API.
2016-12-28 21:53:51 -05:00
Jon Moss 61de442250 Add asset compilation Rake task for UJS
Uses same build pipeline (Blade) as Action Cable. Will run when Rails
gems are being built for release.
2016-11-26 08:58:55 -05:00
Guillermo Iguaran 02568801e6 Add UJS tests 2016-11-26 01:23:07 -05:00
Xavier Noria bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
Xavier Noria 63fff600ac modernizes hash syntax in actionview 2016-08-06 19:36:34 +02:00
Xavier Noria e6ab70c439 applies new string literal convention to the rest of the project
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:28:46 +02:00
Javan Makhmali d12209cad2 Remove package:clean task
Introduced in d6f2000a67 and was only used by Action Cable. Now handled by Action Cable’s assets:compile task.
2016-05-24 13:11:28 -04:00
Matthew Draper d6f2000a67 Wrangle the asset build into something that sounds more general 2016-02-01 05:03:03 +10:30
Arun Agrawal 21b6b68f63 Remove unused package tasks
We are using `all:build` now.
2015-05-28 09:06:10 +02:00
Rafael Mendonça França be18476fb2 Merge pull request #20263 from arunagw/aa-remove-custom-lines-actionview
Remove custom `lines` and use `/tools/line_statistics`
2015-05-28 01:10:47 -03:00
Arun Agrawal b9e0073b41 Remove custom `lines` and use `/tools/line_statistics` 2015-05-22 16:35:08 +02:00
Arun Agrawal 4194d052d8 Remove broken and unused release task
- We do release with release.rb
- There is no `rake/gemcutter`
2015-05-22 14:30:30 +02:00
Matthew Draper e462021396 Revert "For now, we will keep sorting the tests."
This reverts commit 7025d7769d.
2015-03-06 04:39:20 +10:30
Robin Dupret 1fac7b79f3 Follow up to #16613
Since we want this flag to be enabled anytime we are running the tests
under JRuby, let's enable this at the Rakefile level so people get the
performance boost on their local checkout.

Moreover, we avoid having to update this particular line anytime the
option changes on the JRuby side.

The only drawback is that we have to define it in every Rakefile but
there's no big deal, this is already the case for other options.
2014-09-28 12:04:06 +02:00
Matthew Draper 7025d7769d For now, we will keep sorting the tests.
This reverts commits e969c92846 and
bd2b3fbe54.
2014-09-05 23:33:27 +09:30
Akira Matsuda bd2b3fbe54 No need to sort tests
Dir.glob result must be already sorted anyway
2014-08-28 14:41:00 +09:00
Arun Agrawal 9a16872aee Running all isolated test for actionview
1. fix name for activerecord directory
2. Added actionpack directory to run tests
2013-10-03 00:00:50 +02:00
Łukasz Strzałkowski 7620ab08be Move actionpack's controller tests 2013-08-25 11:40:10 +02:00
Łukasz Strzałkowski 53e65e1772 Add AP tests to runner 2013-08-25 11:39:14 +02:00
Łukasz Strzałkowski 969b22f189 Cleanup & reorganise rake tasks in AV 2013-08-25 11:39:14 +02:00
Arun Agrawal f52832de2a grab executable from rubygems
As done here d7fc97d3f9
2013-07-26 11:07:25 +02:00
Arun Agrawal d6da0dc3f2 Removed unused require from actionview rakefile. 2013-07-09 00:10:24 +02:00
Arun Agrawal c4f588213b Minor changes to actionpack/actionview Rakefile 2013-06-26 10:22:10 +02:00