]>
git.immae.eu Git - github/fretlink/pronto-hlint.git/blob - spec/pronto/eslint_spec.rb
5 let(:eslint) { ESLintNpm
.new(patches
) }
8 subject(:run) { eslint
.run
}
10 context
'patches are nil' do
13 it
'returns an empty array' do
14 expect(run
).to
eql([])
18 context
'no patches' do
21 it
'returns an empty array' do
22 expect(run
).to
eql([])
26 context
'patches with a one and a four warnings' do
27 include_context
'test repo'
29 let(:patches) { repo
.diff('master') }
31 it
'returns correct number of errors' do
32 expect(run
.count
).to
eql(5)
35 it
'has correct first message' do
36 expect(run
.first
.msg
).to
eql("'foo' is not defined.")
40 context
'repo with ignored and not ignored file, each with three warnings' do
41 include_context
'eslintignore repo'
43 let(:patches) { repo
.diff('master') }
45 it
'returns correct number of errors' do
46 expect(run
.count
).to
eql(3)
49 it
'has correct first message' do
50 expect(run
.first
.msg
).to
eql("'HelloWorld' is defined but never used.")
55 describe
'.files_to_lint' do
56 subject(:files_to_lint) { ESLintNpm
.files_to_lint
}
58 it
'matches .js by default' do
59 expect(files_to_lint
).to
match('my_js.js')
62 it
'matches .es6 by default' do
63 expect(files_to_lint
).to
match('my_js.es6')
67 describe
'.eslint_executable' do
68 subject(:eslint_executable) { ESLintNpm
.eslint_executable
}
70 it
'is `eslint` by default' do
71 expect(eslint_executable
).to
eql('eslint')