Comments (5)
Are you using the Rake task? Did you call Opal.use_gem from the Rakefile?
It sounds like a load path issue. I use jquery in my tests all the time.
from opal-rspec.
If you're using Rails but not using opal-rails, then you'd do something like this (I have 2 spec directories, thus the shared reference):
Opal::RSpec::RakeTask.new('opal:spec' => :environment) do |server, task|
app = Rails.application
task.files = FileList[
app.root.join('spec/javascripts/**/*_spec{,.js}.{rb,opal}'),
app.root.join('spec/shared/**/*_spec{,.js}.{rb,opal}')
]
task.default_path = 'spec/javascripts'
app.assets.paths.each { |p| server.append_path p }
%w(spec/javascripts spec/shared).each { |p| server.append_path p }
end
The only magic here is the app.assets line, which takes the Rails sprockets load paths (already populated via Bundle.require
to force each GEM to add itself to the load path and my opal.rb
initializer, which adds the Opal load paths to sprockets/Rails).
I'm not sure what the latest is with opal-rails since I've been working on other stuff.
from opal-rspec.
thanks - I did not try your suggestion, instead I ended up doing this:
# in reactive-ruby.rb
...
Opal.append_path File.expand_path('../sources/', __FILE__).untaint
Once I did this everything got better
from opal-rspec.
Hopefully this clarifies a little - 7e9a7ab
from opal-rspec.
thanks
from opal-rspec.
Related Issues (20)
- Performance Improvement Ideas HOT 4
- issues with opal 0.10.0 HOT 4
- Results Reporting Sync/Async HOT 1
- filter_run_excluding not working? HOT 1
- stub_const doesn't work quite the same in opal 0.9 HOT 9
- Opal-Master Compatibility
- Sprockets HOT 1
- Support random order HOT 2
- Opal::RSpec::RakeTask HOT 4
- `expect_any_instance_of` is not working when using opal master HOT 5
- Trying to run phantomjs or in-browser tests throws Sprockets::FileNotFound HOT 3
- Get ` cannot load such file -- rake` when run test in browser. HOT 2
- Could not found jquery when use node as task runner. HOT 1
- spec not worked with opal 0.11. (chrome headless) HOT 11
- Unable to require 'nodejs' in spec HOT 2
- uninitialized constant OPAL_PLATFORM HOT 8
- Headless Chrome support HOT 3
- Can you release a new version? HOT 3
- opal-rspec --init leads to erro cannot load such file -- opal-sprockets (LoadError) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opal-rspec.