diff --git a/CHANGES.md b/CHANGES.md index 8793146..06f5cbc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +## v0.6.1 2015-07-27 21:52:50+0300 + +* Now code raises exception with correct file name when TS compilation error occurs + ## v0.6.0 2015-07-06 22:36:25+0300 * Updated version to 0.6.0 for using Typescript source 1.4.1.3 diff --git a/lib/typescript/rails/compiler.rb b/lib/typescript/rails/compiler.rb index 9f7aa74..093b311 100644 --- a/lib/typescript/rails/compiler.rb +++ b/lib/typescript/rails/compiler.rb @@ -57,7 +57,11 @@ def compile(ts_path, source, context=nil, *options) end end s = replace_relative_references(ts_path, source) - ::TypeScript::Node.compile(s, *default_options, *options) + begin + ::TypeScript::Node.compile(s, *default_options, *options) + rescue Exception => e + raise "Typescript error in file '#{ts_path}':\n#{e.message}" + end end end diff --git a/lib/typescript/rails/version.rb b/lib/typescript/rails/version.rb index afbde79..e43acde 100644 --- a/lib/typescript/rails/version.rb +++ b/lib/typescript/rails/version.rb @@ -1,5 +1,5 @@ module Typescript module Rails - VERSION = '0.6.0' + VERSION = '0.6.1' end end diff --git a/test/assets_test.rb b/test/assets_test.rb index 951b803..6b543fa 100644 --- a/test/assets_test.rb +++ b/test/assets_test.rb @@ -1,8 +1,8 @@ require File.join(File.dirname(__FILE__), 'test_helper.rb') require 'typescript-rails' -require "action_controller/railtie" -require "sprockets/railtie" +require 'action_controller/railtie' +require 'sprockets/railtie' class AssetsTest < ActiveSupport::TestCase @@ -19,7 +19,7 @@ def setup env.cache = ActiveSupport::Cache.lookup_store(:memory_store) end @app.config.assets.paths << "#{File.dirname(__FILE__)}/fixtures/assets" - @app.paths["log"] = "#{tmp_path}/log/test.log" + @app.paths['log'] = "#{tmp_path}/log/test.log" @app.initialize! end @@ -41,8 +41,8 @@ def assets end test 'assets .js.ts is compiled from TypeScript to JavaScript' do - assert { assets["javascripts/hello"].present? } - assert { assets["javascripts/hello"].source.include?('var log_to_console = function (x) {') } - assert { assets["javascripts/hello"].source.include?('var s = "Hello, world!";') } + assert { assets['javascripts/hello'].present? } + assert { assets['javascripts/hello'].source.include?('var log_to_console = function (x) {') } + assert { assets['javascripts/hello'].source.include?('var s = "Hello, world!";') } end end \ No newline at end of file diff --git a/test/template_handler_test.rb b/test/template_handler_test.rb index a1271f6..b0aef0f 100644 --- a/test/template_handler_test.rb +++ b/test/template_handler_test.rb @@ -1,9 +1,9 @@ -require 'test_helper' +require File.join(File.dirname(__FILE__), 'test_helper.rb') require 'action_controller' require 'typescript-rails' class SiteController < ActionController::Base - self.view_paths = File.expand_path("../fixtures", __FILE__) + self.view_paths = File.expand_path('../fixtures', __FILE__) end DummyApp = ActionDispatch::Routing::RouteSet.new @@ -29,26 +29,26 @@ def source last_response.body.gsub(%r{^//[^\n]*}m, '') end - test "typescript views are served as javascript" do - get "/site/index.js" + test 'typescript views are served as javascript' do + get '/site/index.js' assert_match /var x = 5;\s*/, source end - test " to other .ts file works" do - get "/site/ref1_2.js" + test ' to other .ts file works' do + get '/site/ref1_2.js' assert_match /var f = function \(x, y\) \{\s*return x \+ y;\s*\};\s*f\(1, 2\);\s*/, source end - test " to other .d.ts file works" do - get "/site/ref2_2.js" + test ' to other .d.ts file works' do + get '/site/ref2_2.js' assert_match /f\(1, 2\);\s*/, source end - test " to multiple .ts files works" do - get "/site/ref3_1.js" + test ' to multiple .ts files works' do + get '/site/ref3_1.js' assert_match /var f1 = function \(\) \{\s*\};\s*var f2 = function \(\) \{\s*\};\s*f1\(\);\s*f2\(\);/, source end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy