File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
1
const { message} = require ( "danger" )
2
2
const { readFileSync, existsSync} = require ( "fs" )
3
+ const parseDiff = require ( "parse-diff" )
3
4
4
5
const diffPath = "./TypeScript/baseline-changes.diff"
5
6
if ( existsSync ( diffPath ) ) {
6
7
const diffContents = readFileSync ( diffPath , "utf8" )
7
- message ( diffContents )
8
+ const diffedFiles = parseDiff ( diffContents )
9
+
10
+ const uninterestingFiles = [ ".generated.d.ts" , "globalThisBlockscopedProperties.types" , "mappedTypeRecursiveInference.types" ]
11
+ const withoutKnownNormalFails = diffedFiles . filter ( diff => {
12
+ return uninterestingFiles . filter ( suffix => diff . to ?. endsWith ( suffix ) ) . length > 0
13
+ } )
14
+
15
+ const md = [ "## Changed baselines from the TypeScript test suite" ]
16
+
17
+ withoutKnownNormalFails . forEach ( diff => {
18
+ md . push ( `#### ${ diff . to || diff . from } }` )
19
+
20
+ md . push ( "```diff" )
21
+ diff . chunks . forEach ( chunk => {
22
+ md . push ( chunk . content )
23
+ } )
24
+ md . push ( "```" )
25
+ } )
26
+
27
+
28
+ message ( md . join ( "\n" ) )
8
29
}
Original file line number Diff line number Diff line change 19
19
"danger" : " ^10.5.4" ,
20
20
"jsdom" : " ^16.4.0" ,
21
21
"node-fetch" : " ^2.6.1" ,
22
+ "parse-diff" : " ^0.7.0" ,
22
23
"print-diff" : " ^1.0.0" ,
23
24
"styleless-innertext" : " ^1.1.2" ,
24
25
"typescript" : " 4.1.0-dev.20200908" ,
You can’t perform that action at this time.
0 commit comments