Skip to content

Commit

Permalink
build: build modules and examples for karma
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonaden committed Mar 9, 2017
1 parent 2b44854 commit bebedfe
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion packages/compiler/test/aot/compiler_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
13 changes: 8 additions & 5 deletions packages/compiler/test/aot/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
}

Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions packages/router/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],

Expand Down
1 change: 1 addition & 0 deletions scripts/ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
1 change: 1 addition & 0 deletions scripts/ci/test-js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bebedfe

Please sign in to comment.