aboutsummaryrefslogtreecommitdiffstats
path: root/t/150-javascript.t
blob: 208b4977fba69c125df082f50d6a58d64ae05c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More;

chdir 't/git-repo/' or die $!;

system('cp -R ../../node_modules .');
ok !$?;

system('cp ../*.js .');
ok !$?;

my $output = `ls -1 | grep .*\.js`;

ok $output eq 'test.js
uncommitted.js
', 'Both test JavaScript files are present';

system('git add test.js');
ok !$?;

$output = `git commit 2>&1`;

ok $output eq "test.js: line 1, col 21, Missing semicolon.
test.js: line 3, col 1, Bad line breaking before '&&'.
test.js: line 3, col 9, Expected an assignment or function call and instead saw an expression.

3 errors
", 'jshint ran on committed JavaScript file';

$output = `git reset`;
ok !$?;

done_testing;