1
1
/// <reference path="../harness.ts" />
2
2
3
3
describe ( "Public APIs" , ( ) => {
4
- it ( "for the language service and compiler should be acknowledged when they change" , ( ) => {
5
- Harness . Baseline . runBaseline ( "api/typescript.d.ts" , ( ) => Harness . IO . readFile ( "built/local/typescript.d.ts" ) ) ;
4
+ function verifyApi ( fileName : string ) {
5
+ const builtFile = `built/local/${ fileName } ` ;
6
+ const api = `api/${ fileName } ` ;
7
+ let fileContent : string ;
8
+ before ( ( ) => {
9
+ fileContent = Harness . IO . readFile ( builtFile ) ;
10
+ } ) ;
11
+
12
+ it ( "should be acknowledged when they change" , ( ) => {
13
+ Harness . Baseline . runBaseline ( api , ( ) => fileContent ) ;
14
+ } ) ;
15
+
16
+ it ( "should compile" , ( ) => {
17
+ const testFile : Harness . Compiler . TestFile = {
18
+ unitName : builtFile ,
19
+ content : fileContent
20
+ } ;
21
+ const inputFiles = [ testFile ] ;
22
+ const output = Harness . Compiler . compileFiles ( inputFiles , [ ] , /*harnessSettings*/ undefined , /*options*/ { } , /*currentDirectory*/ undefined ) ;
23
+ assert ( ! output . result . errors || ! output . result . errors . length , Harness . Compiler . minimalDiagnosticsToString ( output . result . errors , /*pretty*/ true ) ) ;
24
+ } ) ;
25
+ }
26
+
27
+ describe ( "for the language service and compiler" , ( ) => {
28
+ verifyApi ( "typescript.d.ts" ) ;
6
29
} ) ;
7
- it ( "for the language server should be acknowledged when they change" , ( ) => {
8
- Harness . Baseline . runBaseline ( "api/tsserverlibrary.d.ts" , ( ) => Harness . IO . readFile ( "built/local/tsserverlibrary.d.ts" ) ) ;
30
+
31
+ describe ( "for the language server" , ( ) => {
32
+ verifyApi ( "tsserverlibrary.d.ts" ) ;
9
33
} ) ;
10
- } ) ;
34
+ } ) ;
0 commit comments