@@ -12,6 +12,11 @@ import { describeServeBuilder } from '../jasmine-helpers';
12
12
import { BASE_OPTIONS , DEV_SERVER_BUILDER_INFO } from '../setup' ;
13
13
14
14
describeServeBuilder ( executeDevServer , DEV_SERVER_BUILDER_INFO , ( harness , setupTarget ) => {
15
+ beforeEach ( async ( ) => {
16
+ // Application code is not needed for these tests
17
+ await harness . writeFile ( 'src/main.ts' , 'console.log("TEST");' ) ;
18
+ } ) ;
19
+
15
20
const javascriptFileContent =
16
21
"import {foo} from 'unresolved'; /* a comment */const foo = `bar`;\n\n\n" ;
17
22
@@ -53,6 +58,42 @@ describeServeBuilder(executeDevServer, DEV_SERVER_BUILDER_INFO, (harness, setupT
53
58
expect ( await response ?. text ( ) ) . toContain ( javascriptFileContent ) ;
54
59
} ) ;
55
60
61
+ it ( 'serves a project CSS asset unmodified' , async ( ) => {
62
+ const cssFileContent = 'p { color: blue };' ;
63
+ await harness . writeFile ( 'src/extra.css' , cssFileContent ) ;
64
+
65
+ setupTarget ( harness , {
66
+ assets : [ 'src/extra.css' ] ,
67
+ } ) ;
68
+
69
+ harness . useTarget ( 'serve' , {
70
+ ...BASE_OPTIONS ,
71
+ } ) ;
72
+
73
+ const { result, response } = await executeOnceAndFetch ( harness , 'extra.css' ) ;
74
+
75
+ expect ( result ?. success ) . toBeTrue ( ) ;
76
+ expect ( await response ?. text ( ) ) . toBe ( cssFileContent ) ;
77
+ } ) ;
78
+
79
+ it ( 'serves a project SCSS asset unmodified' , async ( ) => {
80
+ const cssFileContent = 'p { color: blue };' ;
81
+ await harness . writeFile ( 'src/extra.scss' , cssFileContent ) ;
82
+
83
+ setupTarget ( harness , {
84
+ assets : [ 'src/extra.scss' ] ,
85
+ } ) ;
86
+
87
+ harness . useTarget ( 'serve' , {
88
+ ...BASE_OPTIONS ,
89
+ } ) ;
90
+
91
+ const { result, response } = await executeOnceAndFetch ( harness , 'extra.scss' ) ;
92
+
93
+ expect ( result ?. success ) . toBeTrue ( ) ;
94
+ expect ( await response ?. text ( ) ) . toBe ( cssFileContent ) ;
95
+ } ) ;
96
+
56
97
it ( 'should return 404 for non existing assets' , async ( ) => {
57
98
setupTarget ( harness , {
58
99
assets : [ ] ,
0 commit comments