jshint4r 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bin/jshint4r +8 -0
- data/lib/jshint4r/cli.rb +78 -0
- data/lib/jshint4r/config.rb +67 -0
- data/lib/jshint4r/jshint_runner.js +5 -0
- data/lib/jshint4r/linter.rb +21 -0
- data/lib/jshint4r/reporter/compilation.rb +25 -0
- data/lib/jshint4r/reporter/text.rb +31 -0
- data/lib/jshint4r/reporter.rb +19 -0
- data/lib/jshint4r/result.rb +18 -0
- data/lib/jshint4r/source.rb +26 -0
- data/lib/jshint4r/target.rb +60 -0
- data/lib/jshint4r.rb +8 -0
- data/lib/tasks/git-untracked.rake +6 -0
- data/spec/fixtures/config.yml +9 -0
- data/spec/fixtures/missing_semicolon.js +1 -0
- data/spec/fixtures/no_errors.js +1 -0
- data/spec/jshint4r/config_spec.rb +115 -0
- data/spec/jshint4r/linter_spec.rb +36 -0
- data/spec/jshint4r/reporter/compilcation_spec.rb +32 -0
- data/spec/jshint4r/reporter/text_spec.rb +44 -0
- data/spec/jshint4r/reporter_spec.rb +43 -0
- data/spec/jshint4r/result_spec.rb +121 -0
- data/spec/jshint4r/source_spec.rb +38 -0
- data/spec/jshint4r/target_spec.rb +134 -0
- data/spec/jshint4r_spec.rb +8 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/sample_error.rb +22 -0
- data/vendor/jshint/CHANGELOG +63 -0
- data/vendor/jshint/README.markdown +70 -0
- data/vendor/jshint/jshint.js +4026 -0
- metadata +200 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JSHint4r::Reporter::Compilation do
|
4
|
+
before(:all) {
|
5
|
+
@reporter = JSHint4r.reporter( :compilation )
|
6
|
+
}
|
7
|
+
|
8
|
+
describe 'report' do
|
9
|
+
context 'ordinary errors' do
|
10
|
+
subject {
|
11
|
+
target, errors = sample_error
|
12
|
+
@reporter.report( target, errors )
|
13
|
+
}
|
14
|
+
it {
|
15
|
+
should eq(<<EOD)
|
16
|
+
jshint.js:4019:32: Missing semicolon.
|
17
|
+
itself.edition = '2011-04-16'
|
18
|
+
jshint.js:4026:28: Missing semicolon.
|
19
|
+
exports.JSHINT = JSHINT
|
20
|
+
EOD
|
21
|
+
}
|
22
|
+
end
|
23
|
+
context 'no errors' do
|
24
|
+
subject {
|
25
|
+
@reporter.report( 'jshint.js', nil )
|
26
|
+
}
|
27
|
+
it {
|
28
|
+
should be_nil
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JSHint4r::Reporter::Text do
|
4
|
+
before(:all) {
|
5
|
+
@reporter = JSHint4r.reporter( :text )
|
6
|
+
}
|
7
|
+
|
8
|
+
describe 'report' do
|
9
|
+
context 'ordinary errors' do
|
10
|
+
subject {
|
11
|
+
target, errors = sample_error
|
12
|
+
@reporter.report( target, errors )
|
13
|
+
}
|
14
|
+
it {
|
15
|
+
should eq(<<EOD)
|
16
|
+
jshint.js: line 4019, col 32, Missing semicolon.
|
17
|
+
jshint.js: line 4026, col 28, Missing semicolon.
|
18
|
+
|
19
|
+
2 errors
|
20
|
+
EOD
|
21
|
+
}
|
22
|
+
end
|
23
|
+
describe 'no errors' do
|
24
|
+
context 'verbose' do
|
25
|
+
subject {
|
26
|
+
@reporter.report( 'jshint.js', nil, true )
|
27
|
+
}
|
28
|
+
it {
|
29
|
+
should eq(<<EOD)
|
30
|
+
jshint.js ... ok
|
31
|
+
EOD
|
32
|
+
}
|
33
|
+
end
|
34
|
+
context 'silent' do
|
35
|
+
subject {
|
36
|
+
@reporter.report( 'jshint.js', nil )
|
37
|
+
}
|
38
|
+
it {
|
39
|
+
should be_nil
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class JSHint4r::TestingReporter
|
4
|
+
include JSHint4r::Reporter
|
5
|
+
end
|
6
|
+
|
7
|
+
describe JSHint4r::Reporter do
|
8
|
+
describe 'reporter' do
|
9
|
+
context 'no args' do
|
10
|
+
subject {
|
11
|
+
JSHint4r.reporter
|
12
|
+
}
|
13
|
+
it {
|
14
|
+
subject.class.should be(JSHint4r::Reporter::Text)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
context :text do
|
18
|
+
subject {
|
19
|
+
JSHint4r.reporter( :text )
|
20
|
+
}
|
21
|
+
it {
|
22
|
+
subject.class.should be(JSHint4r::Reporter::Text)
|
23
|
+
}
|
24
|
+
end
|
25
|
+
context :compilation do
|
26
|
+
subject {
|
27
|
+
JSHint4r.reporter( :compilation )
|
28
|
+
}
|
29
|
+
it {
|
30
|
+
subject.class.should be(JSHint4r::Reporter::Compilation)
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'symbolize' do
|
36
|
+
subject {
|
37
|
+
JSHint4r::TestingReporter.new
|
38
|
+
}
|
39
|
+
it {
|
40
|
+
subject.key_symbolize( 'abc' => 123 ).should eq( :abc => 123 )
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JSHint4r::Result do
|
4
|
+
def __DATA__
|
5
|
+
File.read(__FILE__).sub(/.*\n__END__\n(.*)$/m, '\1')
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:all) {
|
9
|
+
@errors = JSHint4r::Result.new( 'target.js', __DATA__ )
|
10
|
+
}
|
11
|
+
|
12
|
+
describe 'target' do
|
13
|
+
subject {
|
14
|
+
@errors.target
|
15
|
+
}
|
16
|
+
it {
|
17
|
+
should == 'target.js'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'errors' do
|
22
|
+
subject {
|
23
|
+
@errors.errors
|
24
|
+
}
|
25
|
+
it {
|
26
|
+
subject.class.should be(Array)
|
27
|
+
}
|
28
|
+
it {
|
29
|
+
subject.size.should == 2
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'parse' do
|
34
|
+
context 'simple key-value' do
|
35
|
+
subject {
|
36
|
+
@errors.parse( "{ abc: 'def' }" )
|
37
|
+
}
|
38
|
+
it {
|
39
|
+
should eq( { 'abc' => 'def' } )
|
40
|
+
}
|
41
|
+
end
|
42
|
+
context 'value is bare word' do
|
43
|
+
subject {
|
44
|
+
@errors.parse( "{ abc: def }" )
|
45
|
+
}
|
46
|
+
it {
|
47
|
+
expect{subject}.should raise_error(ExecJS::ProgramError)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
context "'[]'" do
|
51
|
+
subject {
|
52
|
+
@errors.parse( '[]' )
|
53
|
+
}
|
54
|
+
it {
|
55
|
+
should eq([])
|
56
|
+
}
|
57
|
+
end
|
58
|
+
context 'empty array' do
|
59
|
+
subject {
|
60
|
+
@errors.parse( [] )
|
61
|
+
}
|
62
|
+
it {
|
63
|
+
expect{should}.to raise_error(TypeError)
|
64
|
+
}
|
65
|
+
end
|
66
|
+
context 'empty string' do
|
67
|
+
subject {
|
68
|
+
@errors.parse( '' )
|
69
|
+
}
|
70
|
+
it {
|
71
|
+
should be_nil
|
72
|
+
}
|
73
|
+
end
|
74
|
+
context 'nil' do
|
75
|
+
subject {
|
76
|
+
@errors.parse( nil )
|
77
|
+
}
|
78
|
+
it {
|
79
|
+
should be_nil
|
80
|
+
}
|
81
|
+
end
|
82
|
+
context 'abc' do
|
83
|
+
subject {
|
84
|
+
@errors.parse( 'abc' )
|
85
|
+
}
|
86
|
+
it {
|
87
|
+
expect{subject}.to raise_error(ExecJS::ProgramError)
|
88
|
+
}
|
89
|
+
end
|
90
|
+
context 'var abc' do
|
91
|
+
subject {
|
92
|
+
@errors.parse( 'var abc' )
|
93
|
+
}
|
94
|
+
it {
|
95
|
+
expect{should}.to raise_error(ExecJS::ProgramError)
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
__END__
|
102
|
+
[ { id: '(error)',
|
103
|
+
raw: 'Missing semicolon.',
|
104
|
+
evidence: ' itself.edition = \'2011-04-16\'',
|
105
|
+
line: 4019,
|
106
|
+
character: 32,
|
107
|
+
a: undefined,
|
108
|
+
b: undefined,
|
109
|
+
c: undefined,
|
110
|
+
d: undefined,
|
111
|
+
reason: 'Missing semicolon.' },
|
112
|
+
{ id: '(error)',
|
113
|
+
raw: 'Missing semicolon.',
|
114
|
+
evidence: ' exports.JSHINT = JSHINT',
|
115
|
+
line: 4026,
|
116
|
+
character: 28,
|
117
|
+
a: undefined,
|
118
|
+
b: undefined,
|
119
|
+
c: undefined,
|
120
|
+
d: undefined,
|
121
|
+
reason: 'Missing semicolon.' } ]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JSHint4r::Source do
|
4
|
+
describe 'src' do
|
5
|
+
describe 'include jshint.js' do
|
6
|
+
it {
|
7
|
+
JSHint4r::Source.src.should be_include('JSHINT')
|
8
|
+
}
|
9
|
+
end
|
10
|
+
describe 'include jshint_runner.js' do
|
11
|
+
it {
|
12
|
+
JSHint4r::Source.src.should be_include('JSHINT.run')
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'context' do
|
18
|
+
before(:all) {
|
19
|
+
@subject = JSHint4r::Source.context
|
20
|
+
}
|
21
|
+
context 'ExecJS::*::Context object' do
|
22
|
+
it {
|
23
|
+
@subject.should be_respond_to(:exec)
|
24
|
+
}
|
25
|
+
it {
|
26
|
+
@subject.should be_respond_to(:eval)
|
27
|
+
}
|
28
|
+
it {
|
29
|
+
@subject.should be_respond_to(:call)
|
30
|
+
}
|
31
|
+
end
|
32
|
+
context 'singleton' do
|
33
|
+
it {
|
34
|
+
JSHint4r::Source.context.object_id.should be(@subject.object_id)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JSHint4r::Target do
|
4
|
+
before(:all) {
|
5
|
+
config = JSHint4r::Config.new( fixture( 'config.yml' ) )
|
6
|
+
@target = JSHint4r::Target.new( config.targets, config.excludes )
|
7
|
+
}
|
8
|
+
|
9
|
+
describe 'initialize' do
|
10
|
+
context 'nil' do
|
11
|
+
subject {
|
12
|
+
JSHint4r::Target.new nil, nil
|
13
|
+
}
|
14
|
+
it {
|
15
|
+
subject.targets.should eq([])
|
16
|
+
}
|
17
|
+
it {
|
18
|
+
subject.excludes.should eq([])
|
19
|
+
}
|
20
|
+
end
|
21
|
+
context 'no args' do
|
22
|
+
subject {
|
23
|
+
JSHint4r::Target.new
|
24
|
+
}
|
25
|
+
it {
|
26
|
+
lambda {subject}.should raise_error( ArgumentError )
|
27
|
+
}
|
28
|
+
it {
|
29
|
+
lambda {subject}.should_not raise_error( TypeError )
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'targets' do
|
35
|
+
describe 'Array' do
|
36
|
+
subject {
|
37
|
+
@target.targets.class
|
38
|
+
}
|
39
|
+
it {
|
40
|
+
should eq(Array)
|
41
|
+
}
|
42
|
+
end
|
43
|
+
describe 'size' do
|
44
|
+
subject {
|
45
|
+
@target.targets.size
|
46
|
+
}
|
47
|
+
it {
|
48
|
+
should > 0
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'excludes' do
|
54
|
+
describe 'Array' do
|
55
|
+
subject {
|
56
|
+
@target.excludes.class
|
57
|
+
}
|
58
|
+
it {
|
59
|
+
should eq(Array)
|
60
|
+
}
|
61
|
+
end
|
62
|
+
describe 'size' do
|
63
|
+
subject {
|
64
|
+
@target.excludes.size
|
65
|
+
}
|
66
|
+
it {
|
67
|
+
should > 0
|
68
|
+
}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'each' do
|
73
|
+
describe 'list' do
|
74
|
+
subject {
|
75
|
+
side = []
|
76
|
+
@target.each { |e|
|
77
|
+
side << e
|
78
|
+
}
|
79
|
+
|
80
|
+
side
|
81
|
+
}
|
82
|
+
it {
|
83
|
+
should eq(['spec/fixtures/missing_semicolon.js'])
|
84
|
+
}
|
85
|
+
end
|
86
|
+
describe 'exist' do
|
87
|
+
subject {
|
88
|
+
side = []
|
89
|
+
|
90
|
+
@target.each { |e|
|
91
|
+
side << File.exist?( e )
|
92
|
+
}
|
93
|
+
|
94
|
+
side
|
95
|
+
}
|
96
|
+
it {
|
97
|
+
should eq([true])
|
98
|
+
}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe 'real_targets' do
|
103
|
+
before(:all) {
|
104
|
+
@t = @target.real_targets
|
105
|
+
}
|
106
|
+
describe 'no_errors.js' do
|
107
|
+
subject {
|
108
|
+
@t.grep( /no_errors\.js/ )
|
109
|
+
}
|
110
|
+
it {
|
111
|
+
should eq([])
|
112
|
+
}
|
113
|
+
end
|
114
|
+
describe 'directory not exist' do
|
115
|
+
subject {
|
116
|
+
@t.find { |e| File.directory? e }
|
117
|
+
}
|
118
|
+
it {
|
119
|
+
should be_nil
|
120
|
+
}
|
121
|
+
end
|
122
|
+
describe 'file exists' do
|
123
|
+
subject {
|
124
|
+
@t.find_all { |e| File.file? e }
|
125
|
+
}
|
126
|
+
it {
|
127
|
+
subject.class.should eq(Rake::FileList)
|
128
|
+
}
|
129
|
+
it {
|
130
|
+
subject.size.should > 0
|
131
|
+
}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'jshint4r'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def fixture( name )
|
15
|
+
File.join( File.dirname(__FILE__), 'fixtures', name )
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
def sample_error
|
2
|
+
[ 'jshint.js',
|
3
|
+
[
|
4
|
+
{
|
5
|
+
'id' => '(error)',
|
6
|
+
'raw' => 'Missing semicolon.',
|
7
|
+
'evidence' => ' itself.edition = \'2011-04-16\'',
|
8
|
+
'line' => 4019,
|
9
|
+
'character' => 32,
|
10
|
+
'reason' => 'Missing semicolon.'
|
11
|
+
},
|
12
|
+
{
|
13
|
+
'id' => '(error)',
|
14
|
+
'raw' => 'Missing semicolon.',
|
15
|
+
'evidence' => ' exports.JSHINT = JSHINT',
|
16
|
+
'line' => 4026,
|
17
|
+
'character' => 28,
|
18
|
+
'reason' => 'Missing semicolon.'
|
19
|
+
}
|
20
|
+
]
|
21
|
+
]
|
22
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
April 16, 2011
|
2
|
+
* New edition: 2011-04-16
|
3
|
+
|
4
|
+
* Unit tests for all options and some core functions
|
5
|
+
* A number of small typo and message fixes
|
6
|
+
* JSHint is now a JavaScript/JSON parser only
|
7
|
+
(ADSafe, HTML, CSS related code was removed)
|
8
|
+
* JSHint now supports function-scoped options
|
9
|
+
* JSHint now supports both /*jshint and /*jslint
|
10
|
+
|
11
|
+
* JSHint now supports shebangs (#!)
|
12
|
+
* Added support for typed array globals
|
13
|
+
* Allowed the use of variables/functions before definition.
|
14
|
+
(option 'latedef' to disallow)
|
15
|
+
* Fixed a bug with 'forin' option
|
16
|
+
* Fixed Rhino wrapper's CLI options support
|
17
|
+
* Fixed a bug with JSHint leaking internal variables
|
18
|
+
* Added option 'expr' to allow ExpressionStatement as valid Program
|
19
|
+
* Added an option 'prototypejs' to pre-define Prototype globals
|
20
|
+
* Added XPathResult et al. to the 'browser' option
|
21
|
+
* Added support for 'undefined' as a function parameter
|
22
|
+
* Option 'boss' has now precedence over 'eqeqeq' when it comes to '== null'
|
23
|
+
* Fixed a bug with JSHint parsing getters/setters as function statements
|
24
|
+
* Added an option 'mootools' to pre-define MooTools globals
|
25
|
+
* Added an option 'globalstrict' to allow the use of global strict mode
|
26
|
+
* Added HTMLElement to the browser environment
|
27
|
+
* Added support for the void operator
|
28
|
+
* Fixed a bug with 'new Array'
|
29
|
+
* Added option 'white' to check for trailing whitespaces
|
30
|
+
|
31
|
+
March 01, 2011
|
32
|
+
* New edition: 2011-03-02
|
33
|
+
|
34
|
+
* When library is used from Rhino, you can provide options via command line arguments
|
35
|
+
|
36
|
+
* Added new HTML5 globals to the 'browser' option
|
37
|
+
* Tolerate == null when boss:true
|
38
|
+
* Tolerate undefined variables in the typeof and delete
|
39
|
+
* Tolerate undefined as a formal parameter
|
40
|
+
* Recognize new Array(<expr>) as a valid expression
|
41
|
+
* Added support for explicit case statement fallthroughs (using special comments)
|
42
|
+
* Added third formal parameter to JSHINT for specifying pre-defined globals
|
43
|
+
|
44
|
+
* New option 'asi' to tolerate the use of automatic semicolon insertion
|
45
|
+
* New option 'jquery' to assume jQuery environment
|
46
|
+
* New option 'couch' to assume CouchDB environment
|
47
|
+
|
48
|
+
February 19, 2011
|
49
|
+
* New edition: 2011-02-19
|
50
|
+
|
51
|
+
* Library can act as a Node.js module and a Rhino program
|
52
|
+
|
53
|
+
* Tolerate single statements in if/for/while constructions ('curly' to disallow)
|
54
|
+
* Tolerate arguments.callee and arguments.caller ('noarg' to disallow)
|
55
|
+
* Tolerate empty blocks ('noempty' to disallow)
|
56
|
+
* Tolerate the use of `new` for side-effects ('nonew' to disallow)
|
57
|
+
* Less strict styling check by default ('white' to revert)
|
58
|
+
|
59
|
+
* New option 'boss' to tolerate assignments inside if/for/while
|
60
|
+
* New option 'node' to assume Node environment
|
61
|
+
|
62
|
+
January 19, 2011
|
63
|
+
* Forked JSLint from the edition 2010-12-16
|
@@ -0,0 +1,70 @@
|
|
1
|
+
JSHint, The (Gentler) JavaScript Code Quality Tool
|
2
|
+
==================================================
|
3
|
+
|
4
|
+
JSHint is a fork of Douglas Crockford's [JSLint](http://jslint.com/) that does
|
5
|
+
not tyrannize your code. It is designed to detect errors that actually break your
|
6
|
+
code while skipping things that, according to Crockford, “are known to
|
7
|
+
contribute mistakes in projects”. In other words, JSHint is a fork of JSLint
|
8
|
+
for the real world.
|
9
|
+
|
10
|
+
For example, JSLint does not tolerate the following constructions:
|
11
|
+
|
12
|
+
if (cond) statement();
|
13
|
+
|
14
|
+
It expects all blocks to be enclosed in braces ({}):
|
15
|
+
|
16
|
+
if (cond) {
|
17
|
+
statement();
|
18
|
+
}
|
19
|
+
|
20
|
+
JSHint removes that requirement (but it is still available as an option).
|
21
|
+
|
22
|
+
|
23
|
+
Community
|
24
|
+
---------
|
25
|
+
|
26
|
+
The most important part is that JSHint is developed and supported by
|
27
|
+
the JavaScript developers community and not by one very opinionated person.
|
28
|
+
|
29
|
+
If you use JSLint and think that it is too strict, use
|
30
|
+
[Issues](https://github.com/jshint/jshint/issues) to describe most annoying
|
31
|
+
JSLint gripes you encounter.
|
32
|
+
|
33
|
+
|
34
|
+
Development
|
35
|
+
-----------
|
36
|
+
|
37
|
+
JSHint was forked from the JSLint, edition 2010-12-16.
|
38
|
+
The current stable edition is [2011-02-19](http://jshint.com/jshint.js).
|
39
|
+
|
40
|
+
|
41
|
+
Environments
|
42
|
+
------------
|
43
|
+
|
44
|
+
JSHint can be used as a Node module out of the box:
|
45
|
+
|
46
|
+
var JSHINT = require("jshint.js").JSHINT;
|
47
|
+
|
48
|
+
If you use Rhino, we have a special wrapper script for that:
|
49
|
+
|
50
|
+
java -jar /path/to/js.jar env/rhino.js myscript.js
|
51
|
+
|
52
|
+
Also included is a Windows Scripting Host wrapper:
|
53
|
+
|
54
|
+
cscript env/wsh.js myscript.js
|
55
|
+
|
56
|
+
And if you're on OS X, use Apple's built-in JavaScriptCore:
|
57
|
+
|
58
|
+
env/jsc.sh myscript.js
|
59
|
+
|
60
|
+
Tests
|
61
|
+
-----
|
62
|
+
|
63
|
+
To run tests you will need to install [node.js](http://nodejs.org/) and
|
64
|
+
expresso. You can install the latter with npm:
|
65
|
+
|
66
|
+
npm install expresso
|
67
|
+
|
68
|
+
After that, running tests is as easy as:
|
69
|
+
|
70
|
+
expresso tests/*.js
|