angular-docs-cn/tools/@angular/tsc-wrapped/test/tsc.spec.ts

41 lines
977 B
TypeScript
Raw Normal View History

2016-10-23 16:37:15 -04:00
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as ts from 'typescript';
import {Tsc} from '../src/tsc';
describe('options parsing', () => {
2016-05-26 13:45:37 -04:00
const tsc = new Tsc(
() => `
{
"angularCompilerOptions": {
"googleClosureOutput": true
},
"compilerOptions": {
"module": "commonjs",
"outDir": "built"
}
2016-05-26 13:45:37 -04:00
}`,
() => ['tsconfig.json']);
it('should combine all options into ngOptions', () => {
const {parsed, ngOptions} =
tsc.readConfiguration('projectDir', 'basePath', {target: ts.ScriptTarget.ES2015});
expect(ngOptions).toEqual({
2016-05-26 13:45:37 -04:00
genDir: 'basePath',
googleClosureOutput: true,
module: ts.ModuleKind.CommonJS,
outDir: 'basePath/built',
configFilePath: undefined,
target: ts.ScriptTarget.ES2015
});
});
});