@@ -2,40 +2,39 @@ import {
22 writeMultipleFiles ,
33 deleteFile ,
44 expectFileToMatch ,
5- replaceInFile
5+ replaceInFile ,
66} from '../../../utils/fs' ;
77import { ng } from '../../../utils/process' ;
8- import { stripIndents } from 'common-tags' ;
98import { updateJsonFile } from '../../../utils/project' ;
109import { expectToFail } from '../../../utils/utils' ;
1110
12- export default function ( ) {
13- return writeMultipleFiles ( {
14- 'src/styles.scss' : stripIndents `
11+ export default async function ( ) {
12+ await writeMultipleFiles ( {
13+ 'src/styles.scss' : `
1514 @import './imported-styles.scss';
1615 body { background-color: blue; }
1716 ` ,
18- 'src/imported-styles.scss' : stripIndents `
19- p { background-color: red; }
20- ` ,
21- 'src/app/app.component.scss' : stripIndents `
22- .outer {
23- .inner {
24- background: #fff;
25- }
17+ 'src/imported-styles.scss' : 'p { background-color: red; }' ,
18+ 'src/app/app.component.scss' : `
19+ .outer {
20+ .inner {
21+ background: #fff;
2622 }
27- ` } )
28- . then ( ( ) => deleteFile ( 'src/app/app.component.css' ) )
29- . then ( ( ) => updateJsonFile ( 'angular.json' , workspaceJson => {
30- const appArchitect = workspaceJson . projects [ 'test-project' ] . architect ;
31- appArchitect . build . options . styles = [
32- { input : 'src/styles.scss' } ,
33- ] ;
34- } ) )
35- . then ( ( ) => replaceInFile ( 'src/app/app.component.ts' ,
36- './app.component.css' , './app.component.scss' ) )
37- . then ( ( ) => ng ( 'build' , '--configuration=development' ) )
38- . then ( ( ) => expectToFail ( ( ) => expectFileToMatch ( 'dist/test-project/styles.css' , / e x p o r t s / ) ) )
39- . then ( ( ) => expectToFail ( ( ) => expectFileToMatch ( 'dist/test-project/main-es5.js' ,
40- / " .* m o d u l e \. e x p o r t s .* \. o u t e r .* b a c k g r o u n d : / ) ) ) ;
23+ }
24+ ` ,
25+ } ) ;
26+
27+ await deleteFile ( 'src/app/app.component.css' ) ;
28+ await updateJsonFile ( 'angular.json' , ( workspaceJson ) => {
29+ const appArchitect = workspaceJson . projects [ 'test-project' ] . architect ;
30+ appArchitect . build . options . styles = [ { input : 'src/styles.scss' } ] ;
31+ } ) ;
32+ await replaceInFile ( 'src/app/app.component.ts' , './app.component.css' , './app.component.scss' ) ;
33+
34+ await ng ( 'build' , '--configuration=development' ) ;
35+
36+ await expectToFail ( ( ) => expectFileToMatch ( 'dist/test-project/styles.css' , / e x p o r t s / ) ) ;
37+ await expectToFail ( ( ) =>
38+ expectFileToMatch ( 'dist/test-project/main.js' , / " .* m o d u l e \. e x p o r t s .* \. o u t e r .* b a c k g r o u n d : / ) ,
39+ ) ;
4140}
0 commit comments