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
|
|
|
|
*/
|
|
|
|
|
2016-05-24 13:53:48 -04:00
|
|
|
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(
|
|
|
|
() => `
|
2016-05-24 13:53:48 -04:00
|
|
|
{
|
|
|
|
"angularCompilerOptions": {
|
|
|
|
"googleClosureOutput": true
|
|
|
|
},
|
|
|
|
"compilerOptions": {
|
|
|
|
"module": "commonjs",
|
|
|
|
"outDir": "built"
|
|
|
|
}
|
2016-05-26 13:45:37 -04:00
|
|
|
}`,
|
|
|
|
() => ['tsconfig.json']);
|
2016-05-24 13:53:48 -04:00
|
|
|
|
|
|
|
it('should combine all options into ngOptions', () => {
|
2017-01-12 20:34:31 -05:00
|
|
|
const {parsed, ngOptions} =
|
|
|
|
tsc.readConfiguration('projectDir', 'basePath', {target: ts.ScriptTarget.ES2015});
|
2016-05-24 13:53:48 -04:00
|
|
|
|
|
|
|
expect(ngOptions).toEqual({
|
2016-05-26 13:45:37 -04:00
|
|
|
genDir: 'basePath',
|
2016-05-24 13:53:48 -04:00
|
|
|
googleClosureOutput: true,
|
|
|
|
module: ts.ModuleKind.CommonJS,
|
|
|
|
outDir: 'basePath/built',
|
2017-01-12 20:34:31 -05:00
|
|
|
configFilePath: undefined,
|
|
|
|
target: ts.ScriptTarget.ES2015
|
2016-05-24 13:53:48 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|