Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: test/test_support.ts

Issue 2416003003: Update package name, update and lock clang-format and tslint versions, and format all source files … (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« package.json ('K') | « test/module_test.ts ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// <reference path="../typings/chai/chai.d.ts"/> 1 /// <reference path="../typings/chai/chai.d.ts"/>
2 /// <reference path="../typings/mocha/mocha.d.ts"/> 2 /// <reference path="../typings/mocha/mocha.d.ts"/>
3 /// <reference path="../typings/node/node.d.ts"/> 3 /// <reference path="../typings/node/node.d.ts"/>
4 import chai = require('chai'); 4 import chai = require('chai');
5 import fs = require('fs'); 5 import fs = require('fs');
6 import main = require('../lib/main'); 6 import main = require('../lib/main');
7 import ts = require('typescript'); 7 import ts = require('typescript');
8 8
9 export type StringMap = { 9 export type StringMap = {
10 [k: string]: string 10 [k: string]: string
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 if (sourceName === defaultLibName) { 37 if (sourceName === defaultLibName) {
38 if (!libSourceFile) { 38 if (!libSourceFile) {
39 // Cache to avoid excessive test times. 39 // Cache to avoid excessive test times.
40 libSourceFile = ts.createSourceFile(sourceName, libSource, compilerOpt ions.target, true); 40 libSourceFile = ts.createSourceFile(sourceName, libSource, compilerOpt ions.target, true);
41 } 41 }
42 return libSourceFile; 42 return libSourceFile;
43 } 43 }
44 return undefined; 44 return undefined;
45 }, 45 },
46 writeFile: function(name, text, writeByteOrderMark) { result = text; }, 46 writeFile: function(name, text, writeByteOrderMark) {
47 fileExists: (sourceName) => { return !!nameToContent[sourceName]; }, 47 result = text;
48 readFile: (filename): string => { throw new Error('unexpected call to readFi le'); }, 48 },
49 fileExists: (sourceName) => {
50 return !!nameToContent[sourceName];
51 },
52 readFile: (filename): string => {
53 throw new Error('unexpected call to readFile');
54 },
49 getDefaultLibFileName: () => defaultLibName, 55 getDefaultLibFileName: () => defaultLibName,
50 useCaseSensitiveFileNames: () => false, 56 useCaseSensitiveFileNames: () => false,
51 getCanonicalFileName: (filename) => '../' + filename, 57 getCanonicalFileName: (filename) => '../' + filename,
52 getCurrentDirectory: () => '', 58 getCurrentDirectory: () => '',
53 getNewLine: () => '\n', 59 getNewLine: () => '\n',
54 }; 60 };
55 compilerHost.resolveModuleNames = main.getModuleResolver(compilerHost); 61 compilerHost.resolveModuleNames = main.getModuleResolver(compilerHost);
56 // Create a program from inputs 62 // Create a program from inputs
57 let entryPoints = Object.keys(nameToContent); 63 let entryPoints = Object.keys(nameToContent);
58 let program: ts.Program = ts.createProgram(entryPoints, compilerOptions, compi lerHost); 64 let program: ts.Program = ts.createProgram(entryPoints, compilerOptions, compi lerHost);
(...skipping 25 matching lines...) Expand all
84 90
85 export function translateSource(contents: Input, options: main.TranspilerOptions = {}): string { 91 export function translateSource(contents: Input, options: main.TranspilerOptions = {}): string {
86 let results = translateSources(contents, options); 92 let results = translateSources(contents, options);
87 // Return the main outcome, from 'main.ts'. 93 // Return the main outcome, from 'main.ts'.
88 let result = results[FAKE_MAIN]; 94 let result = results[FAKE_MAIN];
89 // strip out the package:js import as it clutters the output. 95 // strip out the package:js import as it clutters the output.
90 result = result.replace(/import "package:js\/js.dart";\s+/g, ''); 96 result = result.replace(/import "package:js\/js.dart";\s+/g, '');
91 result = result.replace(/^@JS\("?[^)]*"?\)\s+library [^;]+;\s+/g, ''); 97 result = result.replace(/^@JS\("?[^)]*"?\)\s+library [^;]+;\s+/g, '');
92 return result.trim(); 98 return result.trim();
93 } 99 }
OLDNEW
« package.json ('K') | « test/module_test.ts ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698