1
1
import { writeFile } from '../../utils/fs' ;
2
2
import { ng } from '../../utils/process' ;
3
- import { updateJsonFile } from '../../utils/project' ;
4
3
5
4
export default async function ( ) {
6
5
await writeFile (
@@ -12,46 +11,19 @@ export default async function () {
12
11
` ,
13
12
) ;
14
13
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
-
37
14
// when sourcemaps are 'on' the stacktrace will point to the spec.ts file.
38
15
try {
39
- await ng ( 'test' , '--watch' , 'false ' ) ;
16
+ await ng ( 'test' , '--no- watch' , '--source-map ' ) ;
40
17
throw new Error ( 'ng test should have failed.' ) ;
41
18
} catch ( error ) {
42
19
if ( ! error . message . includes ( 'app.component.spec.ts' ) ) {
43
20
throw error ;
44
21
}
45
22
}
46
23
47
- await updateJsonFile ( 'angular.json' , ( configJson ) => {
48
- const appArchitect = configJson . projects [ 'test-project' ] . architect ;
49
- appArchitect . test . options . sourceMap = false ;
50
- } ) ;
51
-
52
24
// when sourcemaps are 'off' the stacktrace won't point to the spec.ts file.
53
25
try {
54
- await ng ( 'test' , '--watch' , 'false ' ) ;
26
+ await ng ( 'test' , '--no- watch' , '--no-source-map ' ) ;
55
27
throw new Error ( 'ng test should have failed.' ) ;
56
28
} catch ( error ) {
57
29
if ( ! error . message . includes ( 'main.js' ) ) {
0 commit comments