feat(tsc-wrapped): allow values to be substituted by collector clients
Also reenabled tests that were unintentionally disabled when they were moved from tools/@angular.
This commit is contained in:

committed by
Alex Rickabaugh

parent
381471d338
commit
67dff7bd5d
54
packages/tsc-wrapped/test/tsc_spec.ts
Normal file
54
packages/tsc-wrapped/test/tsc_spec.ts
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @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';
|
||||
import {VinylFile} from '../src/vinyl_file';
|
||||
|
||||
describe('options parsing', () => {
|
||||
|
||||
const configData = `
|
||||
{
|
||||
"angularCompilerOptions": {
|
||||
"googleClosureOutput": true
|
||||
},
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "built"
|
||||
}
|
||||
}`;
|
||||
|
||||
const tsc = new Tsc(() => configData, () => ['tsconfig.json']);
|
||||
const config = {path: 'basePath/tsconfig.json', contents: new Buffer(configData)};
|
||||
|
||||
it('should combine all options into ngOptions', () => {
|
||||
const {parsed, ngOptions} =
|
||||
tsc.readConfiguration('projectDir', 'basePath', {target: ts.ScriptTarget.ES2015});
|
||||
|
||||
expect(ngOptions).toEqual({
|
||||
genDir: 'basePath',
|
||||
googleClosureOutput: true,
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
outDir: 'basePath/built',
|
||||
configFilePath: undefined,
|
||||
target: ts.ScriptTarget.ES2015
|
||||
});
|
||||
});
|
||||
|
||||
it('should combine all options into ngOptions from vinyl like object', () => {
|
||||
const {parsed, ngOptions} = tsc.readConfiguration(config as VinylFile, 'basePath');
|
||||
|
||||
expect(ngOptions).toEqual({
|
||||
genDir: 'basePath',
|
||||
googleClosureOutput: true,
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
outDir: 'basePath/built',
|
||||
configFilePath: undefined
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user