@@ -12,54 +12,13 @@ import {
1212 SimpleChanges ,
1313 ViewChild ,
1414} from '@angular/core' ;
15- import babel_traverse from '@babel/traverse' ;
16- import * as babylon from 'babylon' ;
17- import * as babel_types from 'babel-types' ;
15+ import { createSystemJsSandbox } from '@codelab/code-demos/src/lib/shared/sandbox' ;
16+ import { ScriptLoaderService } from '@codelab/code-demos/src/lib/shared/script-loader.service' ;
1817import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject' ;
1918import { Subscription } from 'rxjs/internal/Subscription' ;
19+ import { TestRunResult } from '@codelab/utils/src/lib/test-results/common' ;
2020import { handleTestMessage } from './tests' ;
21- import { TestRunResult } from "@codelab/utils" ;
22- import { createSystemJsSandbox } from "@codelab/code-demos" ;
23- import { getTypeScript , ScriptLoaderService } from '@codelab/sandbox-runner' ;
24-
25- const ts = getTypeScript ( ) ;
26-
27- // TODO(kirjs): This is a duplicate
28- export function addMetaInformation ( sandbox , files : { [ key : string ] : string } ) {
29- // sandbox.evalJs(`System.registry.delete(System.normalizeSync('./code'));`);
30-
31- ( sandbox . iframe . contentWindow as any ) . System . register (
32- 'code' ,
33- [ ] ,
34- function ( exports ) {
35- return {
36- setters : [ ] ,
37- execute : function ( ) {
38- exports ( 'ts' , ts ) ;
39- exports ( 'babylon' , babylon ) ;
40- exports ( 'babel_traverse' , babel_traverse ) ;
41- exports ( 'babel_types' , babel_types ) ;
42- Object . entries ( files )
43- . filter ( ( [ moduleName ] ) => moduleName . match ( / \. t s $ / ) )
44- . forEach ( ( [ path , code ] ) => {
45- exports ( path . replace ( / [ \/ . - ] / gi, '_' ) , code ) ;
46- exports (
47- path . replace ( / [ \/ . - ] / gi, '_' ) + '_AST' ,
48- ts . createSourceFile ( path , code , ts . ScriptTarget . ES5 )
49- ) ;
50- } ) ;
51-
52- Object . entries ( files )
53- . filter ( ( [ moduleName ] ) => moduleName . match ( / \. h t m l / ) )
54- . forEach ( ( [ path , code ] ) => {
55- const templatePath = path . replace ( / [ \/ . - ] / gi, '_' ) ;
56- exports ( templatePath , code ) ;
57- } ) ;
58- } ,
59- } ;
60- }
61- ) ;
62- }
21+ import { addMetaInformation } from "@codelab/code-demos/src/lib/shared/helpers" ;
6322
6423@Component ( {
6524 selector : 'codelab-simple-angular-test-runner' ,
@@ -127,8 +86,8 @@ export class SimpleAngularTestRunnerComponent
12786 } ,
12887 ( { evalJs } ) => {
12988 evalJs ( this . scriptLoaderService . getScript ( 'chai' ) ) ;
130- // evalJs(this.scriptLoaderService.getScript('shim'));
13189 evalJs ( this . scriptLoaderService . getScript ( 'zone' ) ) ;
90+ evalJs ( this . scriptLoaderService . getScript ( 'reflectMetadata' ) ) ;
13291 }
13392 ) ;
13493
@@ -162,7 +121,7 @@ export class SimpleAngularTestRunnerComponent
162121 . some ( ( a ) => a ) ;
163122
164123 if ( ! hasErrors ) {
165- sandbox . evalJs ( `System.import('${ this . bootstrap } ')` ) ;
124+ sandbox . evalJs ( `System.import('./ ${ this . bootstrap } ')` ) ;
166125 }
167126 } ) ;
168127 }
0 commit comments