11import { writeFile } from '../../utils/fs' ;
22import { ng } from '../../utils/process' ;
3- import { updateJsonFile } from '../../utils/project' ;
43
54export default async function ( ) {
65 await writeFile (
@@ -12,46 +11,19 @@ export default async function () {
1211 ` ,
1312 ) ;
1413
15- await updateJsonFile ( 'angular.json' , ( configJson ) => {
16- const appArchitect = configJson . projects [ 'test-project' ] . architect ;
17- appArchitect . test . options . sourceMap = {
18- scripts : true ,
19- } ;
20- } ) ;
21-
22- // when sourcemaps are 'on' the stacktrace will point to the spec.ts file.
23- try {
24- await ng ( 'test' , '--watch' , 'false' ) ;
25- throw new Error ( 'ng test should have failed.' ) ;
26- } catch ( error ) {
27- if ( ! error . message . includes ( 'app.component.spec.ts' ) ) {
28- throw error ;
29- }
30- }
31-
32- await updateJsonFile ( 'angular.json' , ( configJson ) => {
33- const appArchitect = configJson . projects [ 'test-project' ] . architect ;
34- appArchitect . test . options . sourceMap = true ;
35- } ) ;
36-
3714 // when sourcemaps are 'on' the stacktrace will point to the spec.ts file.
3815 try {
39- await ng ( 'test' , '--watch' , 'false ' ) ;
16+ await ng ( 'test' , '--no- watch' , '--source-map ' ) ;
4017 throw new Error ( 'ng test should have failed.' ) ;
4118 } catch ( error ) {
4219 if ( ! error . message . includes ( 'app.component.spec.ts' ) ) {
4320 throw error ;
4421 }
4522 }
4623
47- await updateJsonFile ( 'angular.json' , ( configJson ) => {
48- const appArchitect = configJson . projects [ 'test-project' ] . architect ;
49- appArchitect . test . options . sourceMap = false ;
50- } ) ;
51-
5224 // when sourcemaps are 'off' the stacktrace won't point to the spec.ts file.
5325 try {
54- await ng ( 'test' , '--watch' , 'false ' ) ;
26+ await ng ( 'test' , '--no- watch' , '--no-source-map ' ) ;
5527 throw new Error ( 'ng test should have failed.' ) ;
5628 } catch ( error ) {
5729 if ( ! error . message . includes ( 'main.js' ) ) {
0 commit comments