Commit Graph

299 Commits

Author SHA1 Message Date
yuuji.yaginuma
cd34f00627 Install JavaScript packages before run test
Some tests are running yarn install during the test.
The directory used for isolation test is not subject to yarn workspace,
and it occurs because the required package is not installed.
In order to avoid this, I fixed all necessary packages to be installed
before run test and use symlink to `node_modules`.

This is a bit complicated, as `yarn install` needs to be run in a specific
directory before running the test.
However, running `yarn install` every time run the test is expensive
when testing locally and should be avoided.
2019-02-11 09:58:08 +09: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
David Heinemeier Hansson
4838c1716a
Make Webpacker the default JavaScript compiler for Rails 6 (#33079)
* Use Webpacker by default on new apps

* Stop including coffee-rails by default

* Drop using a js_compressor by default

* Drop extra test for coffeescript inclusion by default

* Stick with skip_javascript to signify skipping webpack

* Don't install a JS runtime by default any more

* app/javascript will be the new default directory for JS

* Make it clear that this is just for configuring the default Webpack framework setup now

* Start using the Webpack tag in the default layout

* Irrelevant test

* jQuery is long gone

* Stop having asset pipeline compile default application.js

* Add rails-ujs by default to the Webpack setup

* Add Active Storage JavaScript to application.js pack by default

* Consistent quoting

* Add Turbolinks to default pack

* Add Action Cable to default pack

Need some work on how to set the global consumer that channels will
work with. @javan?

* Require all channels by default and use a separate consumer stub

* Channel generator now targets Webpack style

* Update task docs to match new generator style

* Use uniform import style

* Drop the JS assets generator

It was barely helpful as it was. It’s no longer helpful in a Webpacked
world. Sayonara!

* Add app/javascript to the stats directories

* Simpler import style

Which match the other imports.

* Address test failures from dropping JS compilation (and compression)

* webpacker-default: Modify `AssetsGeneratorTest`

Before:

```
$ bin/test test/generators/assets_generator_test.rb
Run options: --seed 46201

F

Failure:
AssetsGeneratorTest#test_assets [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:12]:
Expected file "app/assets/javascripts/posts.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:10

.

Finished in 0.031343s, 63.8101 runs/s, 95.7152 assertions/s.
2 runs, 3 assertions, 1 failures, 0 errors, 0 skips
```

After:

```
$ bin/test test/generators/assets_generator_test.rb
Run options: --seed 43571

..

Finished in 0.030370s, 65.8545 runs/s, 65.8545 assertions/s.
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
```

* webpacker-default: Modify `ChannelGeneratorTest`

Before:

```
$ bin/test test/generators/channel_generator_test.rb
Run options: --seed 8986

.F

Failure:
ChannelGeneratorTest#test_channel_with_multiple_actions_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:43]:
Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:34

.F

Failure:
ChannelGeneratorTest#test_channel_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:29]:
Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:22

E

Error:
ChannelGeneratorTest#test_cable_js_is_created_if_not_present_already:
Errno::ENOENT: No such file or directory @ apply2files - /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/fixtures/tmp/app/assets/javascripts/cable.js

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:60

F

Failure:
ChannelGeneratorTest#test_channel_suffix_is_not_duplicated [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:87]:
Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:80

F

Failure:
ChannelGeneratorTest#test_channel_on_revoke [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:77]:
Expected file "app/assets/javascripts/cable.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:68

Finished in 0.064384s, 108.7227 runs/s, 481.4861 assertions/s.
7 runs, 31 assertions, 4 failures, 1 errors, 0 skips
```

After:

```
$ bin/test test/generators/channel_generator_test.rb
Run options: --seed 44857

.......

Finished in 0.060243s, 116.1961 runs/s, 697.1764 assertions/s.
7 runs, 42 assertions, 0 failures, 0 errors, 0 skips
```

* Fix shared generator tests.

* webpacker-default: Modify `ControllerGeneratorTest`

The JS assets generator was dropped. ref. 46215b1794

* Revert "Simpler import style". It's currently failing with an error of "TypeError: undefined is not an object (evaluating '__WEBPACK_IMPORTED_MODULE_2_activestorage___default.a.start')". Waiting for @javan to have a look.

This reverts commit 5d3ebb71059f635d3756cbda4ab9752027e09256.

* require webpacker in test app

* Add webpacker without making the build hang/timeout. (#33640)

* use yarn workspaces to allow for installing unreleased packages and only generate js/bootsnap when required

* no longer need to have webpacker in env templates as webpacker moved this config to yml file

* Fix rubocop violation

* Got the test passing for the running scaffold

* update expected lines of code

* update middleware tests to account for webpacker

* disable js in plugins be default to get the tests passing (#34009)

* clear codeclimate report issues

* Anything newer than currently released is good

* Use Webpacker development version during development of Rails

* Edge should get development webpacker as well

* Add changelog entry for Webpacker change
2018-09-30 22:31:21 -07:00
utilum
243c856ce9 Fix assignment of TESTOPTS in railties test task
The assignment of `ENV["TESTOPTS"]` to `ARGV`, introduced in
09f9a7a5b, did not take into account passing multiple options,
such as `--verbose --seed=1`. This patch fixes it.
2018-07-01 11:36:17 +02:00
utilum
09f9a7a5b6 Enable TESTOPTS in railties tests
Unlike the other components' test suites, railties' currently
ignores such useful options as `"--verbose"` or `"--name"`.

This patch allows us to use them.
2018-06-26 12:16:23 +02:00
utilum
a48f6a5d9f Enable warnings in all test tasks
Also normalize AJ task use t, like all other Rails test tasks.
2018-05-23 23:05:03 +02:00
Matthew Draper
802ce8a239 Run in-app rails commands via fork+load where possible
While this avoids shell argument parsing, we still pass through
everything in our stack.
2017-09-04 20:19:39 +09:30
Matthew Draper
6a099b1682 Run all railties tests before reporting failure 2017-09-03 05:15:14 +09:30
Matthew Draper
b342db680b Don't start a new process for every test file
This effectively reverts 200cf32e207728df287cac2ec113a7cbe277c1eb,
restoring a variant of 5a0e0e72995472e315738dcea5b5a12d6e3d3489.
2017-09-03 05:15:14 +09:30
Pat Allan
acea68de02 Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
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 5b8738c2df003a96f0e490c43559747618d10f5f
2017-05-23 00:53:51 +03:00
David Heinemeier Hansson
8d99c896e0 Fix ability to run railties test suite 2016-12-08 19:49:30 -08:00
Xavier Noria
477568ee33 modernizes hash syntax in railties 2016-08-06 19:38:55 +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 d6f2000a67cc63aa67414c75ce77de671824ec52 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
Matthew Erhard
200cf32e20 Revert "don't start a new process for every test file"
This reverts commit 5a0e0e72995472e315738dcea5b5a12d6e3d3489.

This commit causes railties tests on TravisCI to always return a 0 status (all tests passing), even when tests are failing. Reverting for now until a new solution can be found.
2015-12-02 15:34:42 -05:00
Aaron Patterson
5a0e0e7299 don't start a new process for every test file
we can just reuse the parent process.  We should figure out what files
are commonly required among the test files and try to require them in
the parent so that the require time cost is amortized across the
processes.
2015-11-03 17:43:08 -08:00
Rafael Mendonça França
2a6071a5e8 Disable warnings in railties tests 2015-08-27 23:49:30 -03:00
Arun Agrawal
21b6b68f63 Remove unused package tasks
We are using `all:build` now.
2015-05-28 09:06:10 +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
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
Arun Agrawal
f6dd6310fc Removed unused require from Rakefile 2013-07-14 14:46:32 +02:00
Arun Agrawal
8b2bde3c26 Removed unused broken task for update README [ci skip] 2013-07-14 14:42:02 +02:00
Arun Agrawal
67f668845e Saying gemcutter => rubygems [ci skip] 2013-06-21 11:04:52 +02:00
Abd ar-Rahman Hamidi
b28e5c3695 Add TEST_DIRS enviroment for constrain test directories in rakefile 2013-04-08 15:16:33 +05:00
Arun Agrawal
9be7ad9a8f Turning on warnings in "rake test" for railties 2013-04-01 11:31:12 +02:00
sanemat
3b98fb77dd Add rake test description
No behavior change
2013-01-01 19:03:40 +09:00
schneems
150561779d remove misleading comment in Rakefile
Comment introduced in https://github.com/rails/rails/commit/bbb3e5a8 before rake `isolate:test` was even introduced https://github.com/rails/rails/commit/bbb3e5a8
2012-09-24 18:49:17 -05:00
Santiago Pastorino
36dd1857dc Remove useless load path modifications 2012-05-11 19:00:35 -03:00
Roman V. Babenko
84feca4aaa Rakefile executable attributes and shebang lines has been removed 2012-05-02 13:38:13 +03:00
Vijay Dev
eb3bfe2936 remove unused pguides rake task from railties 2012-05-02 01:10:59 +05:30
Xavier Noria
6d87cd028b moves the guides up to the root directory 2012-03-17 08:32:49 -07:00
Aaron Patterson
0f04260c51 railties depends on actionpack, so put actionpack in the include path 2011-09-09 19:00:33 -07:00
Aaron Patterson
9736cb2bab rake already ships with a ruby command 2011-09-09 18:56:11 -07:00
Vijay Dev
79e9a2983a fixes Rake::GemPackageTask deprecation warnings from rake 0.9.0 2011-05-24 23:39:24 +05:30
Xavier Noria
5d2cdb190a removes the :update_ujs task in railties 2011-05-04 10:33:53 +02:00
Xavier Noria
b2aacc346c Prototype and Scriptaculous are no longer vendored, but provided by prototype-rails from now on, also the -j option of the application generator is removed 2011-04-30 03:53:24 +02:00
Santiago Pastorino
5076264163 Make update_ujs task update the right files 2011-04-29 21:44:05 -03:00
Aaron Patterson
6ddabaa90c sorry, the CI cannot lie to us anymore 2011-01-12 09:47:04 -08:00
Akira Matsuda
a329e7d9af use https to fetch files from GitHub
see: https://github.com/blog/738-sidejack-prevention-phase-2-ssl-everywhere

[#6223 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-26 08:20:36 -02:00
raggi
cb1570936d Rakefiles are executables, and rake loads rake, not rakefile code 2010-11-25 06:49:55 +08:00
siong1987
708e09448b -j parameter added to rails new command.
Now you can start your apps with jquery with rails new myapp -j jquery, the default is still prototype

[#5613 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-11 19:47:53 -02:00
Xavier Noria
43291469cb deletes the rdoc task of each component, they are no longer published separately 2010-08-20 13:30:31 +02:00
Santiago Pastorino
cad8bef5ea Bump up rdoc to 2.5.10 2010-08-18 11:44:12 -03:00
Aaron Patterson
b50635a59f update Rakefiles for RDoc 2.5 2010-07-23 21:11:29 +02:00
Santiago Pastorino
b378b19430 Makes Rakefile activate rdoc >= 2.5.9
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-07-23 00:04:06 +02:00
José Valim
508fba9e07 Add .rdoc extension to README files. 2010-07-21 12:51:14 +02:00