build: build modules and examples for karma
This commit is contained in:
parent
2b44854885
commit
bebedfed24
|
@ -10,7 +10,6 @@ import {AotCompiler, AotCompilerHost, AotCompilerOptions, createAotCompiler} fro
|
|||
import {RenderComponentType, ɵReflectionCapabilities as ReflectionCapabilities, ɵreflector as reflector} from '@angular/core';
|
||||
import {async} from '@angular/core/testing';
|
||||
import {MetadataBundler, MetadataCollector, ModuleMetadata, privateEntriesToIndex} from '@angular/tsc-wrapped';
|
||||
import * as path from 'path';
|
||||
import * as ts from 'typescript';
|
||||
import {EmittingCompilerHost, MockAotCompilerHost, MockCompilerHost, MockData, MockMetadataBundlerHost, settings} from './test_util';
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ export class EmittingCompilerHost implements ts.CompilerHost {
|
|||
if (distIndex >= 0) {
|
||||
const root = moduleFilename.substr(0, distIndex);
|
||||
this.nodeModulesPath = path.join(root, 'node_modules');
|
||||
this.angularSourcePath = path.join(root, 'modules');
|
||||
this.angularSourcePath = path.join(root, 'packages');
|
||||
|
||||
// Rewrite references to scripts with '@angular' to its corresponding location in
|
||||
// the source tree.
|
||||
|
@ -92,8 +92,10 @@ export class EmittingCompilerHost implements ts.CompilerHost {
|
|||
public get written(): Map<string, string> { return this.writtenFiles; }
|
||||
|
||||
public effectiveName(fileName: string): string {
|
||||
return fileName.startsWith('@angular/') ? path.join(this.angularSourcePath, fileName) :
|
||||
fileName;
|
||||
const prefix = '@angular/';
|
||||
return fileName.startsWith('@angular/') ?
|
||||
path.join(this.angularSourcePath, fileName.substr(prefix.length)) :
|
||||
fileName;
|
||||
}
|
||||
|
||||
// ts.ModuleResolutionHost
|
||||
|
@ -177,7 +179,7 @@ export class MockCompilerHost implements ts.CompilerHost {
|
|||
if (distIndex >= 0) {
|
||||
const root = moduleFilename.substr(0, distIndex);
|
||||
this.nodeModulesPath = path.join(root, 'node_modules');
|
||||
this.angularSourcePath = path.join(root, 'modules');
|
||||
this.angularSourcePath = path.join(root, 'packages');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,7 +311,8 @@ export class MockCompilerHost implements ts.CompilerHost {
|
|||
const rxjs = '/rxjs';
|
||||
if (name.startsWith('/' + node_modules)) {
|
||||
if (this.angularSourcePath && name.startsWith('/' + node_modules + at_angular)) {
|
||||
return path.join(this.angularSourcePath, name.substr(node_modules.length + 1));
|
||||
return path.join(
|
||||
this.angularSourcePath, name.substr(node_modules.length + at_angular.length + 1));
|
||||
}
|
||||
if (this.nodeModulesPath && name.startsWith('/' + node_modules + rxjs)) {
|
||||
return path.join(this.nodeModulesPath, name.substr(node_modules.length + 1));
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
var browserProvidersConf = require('../../../browser-providers.conf.js');
|
||||
var browserProvidersConf = require('../../browser-providers.conf.js');
|
||||
|
||||
// Karma configuration
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
basePath: '../../../',
|
||||
basePath: '../../',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ travisFoldEnd "tsc tools"
|
|||
|
||||
travisFoldStart "tsc all"
|
||||
node --max-old-space-size=3000 dist/tools/@angular/tsc-wrapped/src/main -p packages
|
||||
node --max-old-space-size=3000 dist/tools/@angular/tsc-wrapped/src/main -p modules
|
||||
travisFoldEnd "tsc all"
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ travisFoldEnd "test.unit.node"
|
|||
# TODO(tbosch): remove this and teach karma to serve the right files
|
||||
travisFoldStart "test.unit.rebuildHack"
|
||||
node dist/tools/@angular/tsc-wrapped/src/main -p packages/tsconfig.json
|
||||
node dist/tools/@angular/tsc-wrapped/src/main -p modules/tsconfig.json
|
||||
travisFoldStart "test.unit.rebuildHack"
|
||||
|
||||
|
||||
|
|
1
test.sh
1
test.sh
|
@ -21,6 +21,7 @@ else
|
|||
if [[ $1 == 'node' ]]; then
|
||||
# Note: .metadata.json files are needed for the language service tests!
|
||||
echo "Creating .metadata.json files..."
|
||||
node dist/tools/@angular/tsc-wrapped/src/main -p packages
|
||||
node dist/tools/@angular/tsc-wrapped/src/main -p modules
|
||||
fi
|
||||
node dist/tools/tsc-watch/ $1 watch
|
||||
|
|
Loading…
Reference in New Issue