forked from vim-test/vim-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmocha_typescript_spec.vim
98 lines (70 loc) · 2.32 KB
/
mocha_typescript_spec.vim
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
source spec/support/helpers.vim
describe "Mocha typescript"
before
cd spec/fixtures/mocha-typescript
end
after
call Teardown()
cd -
end
context "on nearest tests"
it "runs typescript"
view +1 test/normal.ts
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.ts --grep ''^Math'''
view +2 test/normal.ts
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.ts --grep ''^Math Addition'''
view +3 test/normal.ts
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.ts --grep ''^Math Addition adds two numbers$'''
end
it "runs typescript JSX"
view +1 test/normal.tsx
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.tsx --grep ''^Math'''
view +2 test/normal.tsx
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.tsx --grep ''^Math Addition'''
view +3 test/normal.tsx
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.tsx --grep ''^Math Addition adds two numbers$'''
end
end
it "runs file test if nearest test couldn't be found"
view +1 test/normal.ts
normal O
TestNearest
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.ts'
end
it "runs file tests"
view test/normal.ts
TestFile
Expect g:test#last_command == 'mocha -r ts-node/register test/normal.ts'
end
it "runs test suites"
view test/normal.ts
TestSuite
Expect g:test#last_command == 'mocha -r ts-node/register --recursive test/ --extension ts'
end
it "also recognizes tests/ directory"
try
!mv test tests
view tests/normal.ts
TestFile
Expect g:test#last_command == 'mocha -r ts-node/register tests/normal.ts'
finally
!mv tests test
endtry
end
it "can handle test file when outside test directory"
view src/addition.test.ts
TestFile
Expect g:test#last_command == 'mocha -r ts-node/register src/addition.test.ts'
end
it "uses a glob path for test suite when not using the standard test directory"
view src/addition.test.ts
TestSuite
Expect g:test#last_command == 'mocha -r ts-node/register "src/**/*.test.ts"'
end
end