Skip to content

Commit 1efab19

Browse files
avikchaudhurifacebook-github-bot
authored andcommitted
types-first recheck skipping test
Summary: test for recheck skipping in types-first Reviewed By: nmote Differential Revision: D15246616 fbshipit-source-id: bea29e01e6a22a51b100380467e10c7242355e8c
1 parent 597f13f commit 1efab19

File tree

10 files changed

+182
-0
lines changed

10 files changed

+182
-0
lines changed

runtests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ assert_errors() {
4040
assert_exit_on_line "${BASH_LINENO[0]}" "$EXIT_ERRS" "$@"
4141
}
4242

43+
show_skipping_stats_classic() {
44+
printf "\\n========Skipping stats========\\n"
45+
grep -o "Merge skipped [0-9]\+ of [0-9]\+ modules" $1 | tail -n 1
46+
}
47+
48+
show_skipping_stats_types_first() {
49+
printf "\\n========Skipping stats========\\n"
50+
grep -o "Merge skipped [0-9]\+ of [0-9]\+ modules" $1 | tail -n 1
51+
grep -o "Check will skip [0-9]\+ files" $1 | tail -n 1
52+
}
53+
4354
show_help() {
4455
printf "Usage: runtests.sh [-hlqrv] [-d DIR] [-t TEST] [-b] FLOW_BINARY [[-f] TEST_FILTER]\n\n"
4556
printf "Runs Flow's tests.\n\n"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ignore]
2+
<PROJECT_ROOT>/tmp*
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
auto_start: false
2+
shell: test.sh
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
mkdir tmp
4+
cp test1.js tmp/
5+
6+
printf "\\nServer should start in types-first mode\\n"
7+
start_flow . --types-first
8+
assert_errors "$FLOW" status --strip-root
9+
10+
printf "\\nAdding a line should cause minimal rechecking (but preserve errors)\\n"
11+
cp tmp1/test1.js test1.js
12+
assert_ok "$FLOW" force-recheck --focus test1.js
13+
assert_errors "$FLOW" status --strip-root
14+
show_skipping_stats_types_first "$FLOW_LOG_FILE"
15+
16+
printf "\\nAdding a comment should cause minimal rechecking (but preserve errors)\\n"
17+
cp tmp2/test1.js test1.js
18+
assert_ok "$FLOW" force-recheck --focus test1.js
19+
assert_errors "$FLOW" status --strip-root
20+
show_skipping_stats_types_first "$FLOW_LOG_FILE"
21+
22+
assert_ok "$FLOW" stop
23+
24+
cp tmp/test1.js test1.js
25+
rm -rf tmp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @flow
2+
3+
export type T = string;
4+
5+
module.exports = 0;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @flow
2+
3+
(require('./test1'): string);
4+
import type { T } from './test1';
5+
export type S = T;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @flow
2+
3+
import type { S } from './test2';
4+
5+
(0: string);
6+
7+
export type R = S;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @flow
2+
3+
export type T = string;
4+
5+
6+
module.exports = 0;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @flow
2+
3+
export type T = string; //
4+
5+
6+
module.exports = 0;
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
2+
Server should start in types-first mode
3+
Error ----------------------------------------------------------------------------------------------------- test2.js:3:2
4+
5+
Cannot cast `require(...)` to string because number [1] is incompatible with string [2].
6+
7+
test2.js:3:2
8+
3| (require('./test1'): string);
9+
^^^^^^^^^^^^^^^^^^
10+
11+
References:
12+
test1.js:5:18
13+
5| module.exports = 0;
14+
^ [1]
15+
test2.js:3:22
16+
3| (require('./test1'): string);
17+
^^^^^^ [2]
18+
19+
20+
Error ----------------------------------------------------------------------------------------------------- test3.js:5:2
21+
22+
Cannot cast `0` to string because number [1] is incompatible with string [2].
23+
24+
test3.js:5:2
25+
5| (0: string);
26+
^ [1]
27+
28+
References:
29+
test3.js:5:5
30+
5| (0: string);
31+
^^^^^^ [2]
32+
33+
34+
35+
Found 2 errors
36+
37+
Adding a line should cause minimal rechecking (but preserve errors)
38+
Error ----------------------------------------------------------------------------------------------------- test2.js:3:2
39+
40+
Cannot cast `require(...)` to string because number [1] is incompatible with string [2].
41+
42+
test2.js:3:2
43+
3| (require('./test1'): string);
44+
^^^^^^^^^^^^^^^^^^
45+
46+
References:
47+
test1.js:6:18
48+
6| module.exports = 0;
49+
^ [1]
50+
test2.js:3:22
51+
3| (require('./test1'): string);
52+
^^^^^^ [2]
53+
54+
55+
Error ----------------------------------------------------------------------------------------------------- test3.js:5:2
56+
57+
Cannot cast `0` to string because number [1] is incompatible with string [2].
58+
59+
test3.js:5:2
60+
5| (0: string);
61+
^ [1]
62+
63+
References:
64+
test3.js:5:5
65+
5| (0: string);
66+
^^^^^^ [2]
67+
68+
69+
70+
Found 2 errors
71+
72+
========Skipping stats========
73+
Merge skipped 1 of 3 modules
74+
Check will skip 1 files
75+
76+
Adding a comment should cause minimal rechecking (but preserve errors)
77+
Error ----------------------------------------------------------------------------------------------------- test2.js:3:2
78+
79+
Cannot cast `require(...)` to string because number [1] is incompatible with string [2].
80+
81+
test2.js:3:2
82+
3| (require('./test1'): string);
83+
^^^^^^^^^^^^^^^^^^
84+
85+
References:
86+
test1.js:6:18
87+
6| module.exports = 0;
88+
^ [1]
89+
test2.js:3:22
90+
3| (require('./test1'): string);
91+
^^^^^^ [2]
92+
93+
94+
Error ----------------------------------------------------------------------------------------------------- test3.js:5:2
95+
96+
Cannot cast `0` to string because number [1] is incompatible with string [2].
97+
98+
test3.js:5:2
99+
5| (0: string);
100+
^ [1]
101+
102+
References:
103+
test3.js:5:5
104+
5| (0: string);
105+
^^^^^^ [2]
106+
107+
108+
109+
Found 2 errors
110+
111+
========Skipping stats========
112+
Merge skipped 2 of 3 modules
113+
Check will skip 2 files

0 commit comments

Comments
 (0)