build(ngc): run integration test hermetically
This ensures we run in a clean directory, using our real distribution. It finds bugs like @internal APIs needed to type-check in the offline compiler, as well as problems in package.json. Also move tsc-wrapped under tools/@angular
This commit is contained in:
@ -78,18 +78,16 @@ At a high level, this program
|
||||
- these `.ts` files are written to the `genDir` path, then compiled together with the application.
|
||||
|
||||
## For developers
|
||||
Run the compiler from source:
|
||||
```
|
||||
# Build angular2 and the compiler
|
||||
./node_modules/.bin/tsc -p modules
|
||||
# Run it on the test project
|
||||
$ ./modules/@angular/compiler_cli./integrationtest.sh
|
||||
```
|
||||
|
||||
Release:
|
||||
```
|
||||
$ ./modules/@angular/compiler_cli./integrationtest.sh
|
||||
$ cp modules/@angular/compiler_cli/README.md modules/@angular/compiler_cli/package.json dist/all/@angular/compiler_cli
|
||||
# npm login as angular
|
||||
$ npm publish dist/all/@angular/compiler_cli --access=public
|
||||
./build.sh
|
||||
# Run the test once
|
||||
# (First edit the LINKABLE_PKGS to use npm link instead of npm install)
|
||||
$ ./scripts/ci-lite/offline_compiler_test.sh
|
||||
# Keep a package fresh in watch mode
|
||||
./node_modules/.bin/tsc -p modules/@angular/compiler/tsconfig-es5.json -w
|
||||
# Iterate on the test
|
||||
cd /tmp/wherever/e2e_test.1464388257/
|
||||
./node_modules/.bin/ngc
|
||||
./node_modules/.bin/jasmine test/*_spec.js
|
||||
```
|
||||
|
@ -1,3 +1,3 @@
|
||||
export {CodeGenerator} from './src/codegen';
|
||||
export {NodeReflectorHost} from './src/reflector_host';
|
||||
export * from 'tsc-wrapped';
|
||||
export * from '@angular/tsc-wrapped';
|
||||
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
cd $(dirname $0)
|
||||
cd $(pwd)/../../..
|
||||
export NODE_PATH=$NODE_PATH:$(pwd)/dist/all:$(pwd)/dist/tools
|
||||
readonly TESTDIR="@angular/compiler_cli/integrationtest"
|
||||
rm -f modules/$TESTDIR/src/*.{ngfactory,css.shim}.ts
|
||||
node dist/all/@angular/compiler_cli/src/main -p modules/$TESTDIR
|
||||
node dist/tools/cjs-jasmine -- $TESTDIR/**/*_spec.js
|
@ -1,3 +1,11 @@
|
||||
// Only needed to satisfy the check in core/src/util/decorators.ts
|
||||
// TODO(alexeagle): maybe remove that check?
|
||||
require('reflect-metadata');
|
||||
|
||||
require('@angular/platform-server/src/parse5_adapter.js').Parse5DomAdapter.makeCurrent();
|
||||
require('zone.js/dist/zone-node.js');
|
||||
require('zone.js/dist/long-stack-trace-zone.js');
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import {BasicNgFactory} from '../src/basic.ngfactory';
|
||||
@ -6,7 +14,7 @@ import {ReflectiveInjector, DebugElement, getDebugNode} from '@angular/core';
|
||||
import {browserPlatform, BROWSER_APP_PROVIDERS} from '@angular/platform-browser';
|
||||
|
||||
describe("template codegen output", () => {
|
||||
const outDir = path.join('dist', 'all', '@angular', 'compiler_cli', 'integrationtest', 'src');
|
||||
const outDir = 'src';
|
||||
|
||||
it("should lower Decorators without reflect-metadata", () => {
|
||||
const jsOutput = path.join(outDir, 'basic.js');
|
||||
@ -62,4 +70,4 @@ describe("template codegen output", () => {
|
||||
expect(debugElement.children[2].attributes['value']).toBe('1');
|
||||
expect(debugElement.children[3].attributes['value']).toBe('2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -2,8 +2,7 @@
|
||||
"angularCompilerOptions": {
|
||||
// For TypeScript 1.8, we have to lay out generated files
|
||||
// in the same source directory with your code.
|
||||
"genDir": ".",
|
||||
"legacyPackageLayout": false
|
||||
"genDir": "."
|
||||
},
|
||||
|
||||
"compilerOptions": {
|
||||
@ -11,13 +10,9 @@
|
||||
"experimentalDecorators": true,
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../../dist/all/@angular/compiler_cli/integrationtest",
|
||||
"rootDir": "",
|
||||
"declaration": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@angular/*": ["../../../../dist/all/@angular/*"]
|
||||
}
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
/// <reference path="../../../../node_modules/@types/node/index.d.ts" />
|
||||
/// <reference path="../../../../node_modules/@types/jasmine/index.d.ts" />
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import * as ts from 'typescript';
|
||||
import * as path from 'path';
|
||||
import {AngularCompilerOptions} from 'tsc-wrapped';
|
||||
import {AngularCompilerOptions} from '@angular/tsc-wrapped';
|
||||
|
||||
import * as compiler from '@angular/compiler';
|
||||
import {ViewEncapsulation} from '@angular/core';
|
||||
|
@ -4,7 +4,7 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import * as ts from 'typescript';
|
||||
import * as tsc from 'tsc-wrapped';
|
||||
import * as tsc from '@angular/tsc-wrapped';
|
||||
|
||||
import {CodeGenerator} from './codegen';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {StaticReflectorHost, StaticSymbol} from './static_reflector';
|
||||
import * as ts from 'typescript';
|
||||
import {AngularCompilerOptions, MetadataCollector, ModuleMetadata} from 'tsc-wrapped';
|
||||
import {AngularCompilerOptions, MetadataCollector, ModuleMetadata} from '@angular/tsc-wrapped';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import {ImportGenerator, AssetUrl} from './compiler_private';
|
||||
|
@ -15,7 +15,7 @@
|
||||
"@angular/compiler": ["../../../dist/packages-dist/compiler"],
|
||||
"@angular/platform-server": ["../../../dist/packages-dist/platform-server"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"],
|
||||
"tsc-wrapped": ["../../../dist/tools/tsc-wrapped"]
|
||||
"@angular/tsc-wrapped": ["../../../dist/tools/@angular/tsc-wrapped"]
|
||||
},
|
||||
"experimentalDecorators": true,
|
||||
"rootDir": ".",
|
||||
|
Reference in New Issue
Block a user