2017-10-13 12:03:28 -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
|
|
|
|
*/
|
|
|
|
|
2018-11-27 15:47:38 -05:00
|
|
|
import {fixmeIvy} from '@angular/private/testing';
|
2017-10-13 12:03:28 -04:00
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
import {setup} from './test_support';
|
|
|
|
|
|
|
|
describe('ngc_wrapped', () => {
|
|
|
|
|
2018-11-27 15:47:38 -05:00
|
|
|
// fixmeIvy placeholder to prevent jasmine from erroring out because there are no specs
|
|
|
|
it('should be removed once the fixmeIvy below is resolved', () => {});
|
|
|
|
|
|
|
|
fixmeIvy('FW-741: ngtsc breaks tsc module resolution') && it('should work', () => {
|
2017-10-13 12:03:28 -04:00
|
|
|
const {read, write, runOneBuild, writeConfig, shouldExist, basePath} = setup();
|
|
|
|
|
|
|
|
write('some_project/index.ts', `
|
|
|
|
import {Component} from '@angular/core';
|
2018-01-29 18:01:38 -05:00
|
|
|
import {a} from 'ambient_module';
|
2017-10-13 12:03:28 -04:00
|
|
|
console.log('works: ', Component);
|
|
|
|
`);
|
|
|
|
|
2018-01-29 18:01:38 -05:00
|
|
|
const tsconfig = writeConfig({
|
2017-10-13 12:03:28 -04:00
|
|
|
srcTargetPath: 'some_project',
|
|
|
|
});
|
2018-01-29 18:01:38 -05:00
|
|
|
const typesFile = path.resolve(
|
|
|
|
tsconfig.compilerOptions.rootDir, tsconfig.compilerOptions.typeRoots[0], 'thing',
|
|
|
|
'index.d.ts');
|
|
|
|
|
|
|
|
write(typesFile, `
|
|
|
|
declare module "ambient_module" {
|
|
|
|
declare const a = 1;
|
|
|
|
}
|
|
|
|
`);
|
2017-10-13 12:03:28 -04:00
|
|
|
|
|
|
|
// expect no error
|
|
|
|
expect(runOneBuild()).toBe(true);
|
|
|
|
|
|
|
|
shouldExist('bazel-bin/some_project/index.js');
|
|
|
|
|
|
|
|
expect(read('bazel-bin/some_project/index.js'))
|
|
|
|
.toContain(`console.log('works: ', core_1.Component);`);
|
|
|
|
});
|
|
|
|
});
|