1- " use strict" ;
1+ ' use strict' ;
22
3- const chai = require ( " chai" ) ;
3+ const chai = require ( ' chai' ) ;
44const expect = chai . expect ;
5- const fs = require ( " fs-extra" ) ;
6- const execa = require ( " execa" ) ;
5+ const fs = require ( ' fs-extra' ) ;
6+ const execa = require ( ' execa' ) ;
77
8- chai . use ( require ( " chai-fs" ) ) ;
8+ chai . use ( require ( ' chai-fs' ) ) ;
99
10- describe ( " generating package.json" , function ( ) {
10+ describe ( ' generating package.json' , function ( ) {
1111 this . timeout ( 300000 ) ;
1212
13- describe ( " with FastBoot builds" , function ( ) {
14- before ( async function ( ) {
15- await execa ( " yarn" , [ " build" ] ) ;
13+ describe ( ' with FastBoot builds' , function ( ) {
14+ before ( async function ( ) {
15+ await execa ( ' yarn' , [ ' build' ] ) ;
1616 } ) ;
1717
18- it ( " builds a package.json" , async function ( ) {
19- expect ( " dist/assets/basic-app.js" ) . to . be . a . file ( ) ;
20- expect ( " dist/package.json" ) . to . be . a . file ( ) ;
18+ it ( ' builds a package.json' , async function ( ) {
19+ expect ( ' dist/assets/basic-app.js' ) . to . be . a . file ( ) ;
20+ expect ( ' dist/package.json' ) . to . be . a . file ( ) ;
2121 } ) ;
2222
23- it ( " merges FastBoot dependencies from multiple addons" , function ( ) {
24- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
23+ it ( ' merges FastBoot dependencies from multiple addons' , function ( ) {
24+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
2525
2626 expect ( pkg . dependencies ) . to . deep . equal ( {
27- "abortcontroller-polyfill" : "^1.4.0" ,
28- foo : "1.0.0" ,
29- bar : "^0.1.2" ,
30- baz : "0.0.0" ,
31- "node-fetch" : "^2.6.0" ,
32- rsvp : "^4.8.5" ,
27+ foo : '1.0.0' ,
28+ bar : '^0.1.2' ,
29+ baz : '0.0.0' ,
30+ rsvp : '^4.8.5' ,
3331 } ) ;
3432 } ) ;
3533
36- it ( " contains a schema version" , function ( ) {
37- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
34+ it ( ' contains a schema version' , function ( ) {
35+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
3836
3937 expect ( pkg . fastboot . schemaVersion ) . to . deep . equal ( 3 ) ;
4038 } ) ;
4139
42- it ( "contains a whitelist of allowed module names" , function ( ) {
43- let pkg = fs . readJSONSync ( "dist/package.json" ) ;
44-
45- expect ( pkg . fastboot . moduleWhitelist ) . to . deep . equal ( [
46- "node-fetch" ,
47- "abortcontroller-polyfill" ,
48- "abortcontroller-polyfill/dist/cjs-ponyfill" ,
49- "path" ,
50- "foo" ,
51- "bar" ,
52- "baz" ,
53- "rsvp" ,
54- ] ) ;
40+ it ( 'contains a whitelist of allowed module names' , function ( ) {
41+ let pkg = fs . readJSONSync ( 'dist/package.json' ) ;
42+
43+ expect ( pkg . fastboot . moduleWhitelist ) . to . deep . equal ( [ 'path' , 'foo' , 'bar' , 'baz' , 'rsvp' ] ) ;
5544 } ) ;
5645
57- it ( " contains a manifest of FastBoot assets" , function ( ) {
58- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
46+ it ( ' contains a manifest of FastBoot assets' , function ( ) {
47+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
5948
6049 expect ( pkg . fastboot . manifest ) . to . deep . equal ( {
61- appFiles : [
62- "assets/basic-app.js" ,
63- "assets/basic-app-fastboot.js" ,
64- "example-addon/bar.js" ,
65- ] ,
66- htmlFile : "index.html" ,
67- vendorFiles : [
68- "example-addon/foo.js" ,
69- "assets/vendor.js" ,
70- "assets/auto-import-fastboot.js" ,
71- "ember-fetch/fetch-fastboot.js" ,
72- ] ,
50+ appFiles : [ 'assets/basic-app.js' , 'assets/basic-app-fastboot.js' , 'example-addon/bar.js' ] ,
51+ htmlFile : 'index.html' ,
52+ vendorFiles : [ 'example-addon/foo.js' , 'assets/vendor.js' , 'assets/auto-import-fastboot.js' ] ,
7353 } ) ;
7454 } ) ;
7555
76- it ( " contains a list of whitelisted hosts from environment.js" , function ( ) {
77- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
56+ it ( ' contains a list of whitelisted hosts from environment.js' , function ( ) {
57+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
7858
7959 expect ( pkg . fastboot . hostWhitelist ) . to . deep . equal ( [
80- " example.com" ,
81- " subdomain.example.com" ,
82- " /localhost:\\d+/" ,
60+ ' example.com' ,
61+ ' subdomain.example.com' ,
62+ ' /localhost:\\d+/' ,
8363 ] ) ;
8464 } ) ;
8565
86- it ( " contains app name" , function ( ) {
87- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
66+ it ( ' contains app name' , function ( ) {
67+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
8868
89- expect ( pkg . fastboot . appName ) . to . equal ( " basic-app" ) ;
69+ expect ( pkg . fastboot . appName ) . to . equal ( ' basic-app' ) ;
9070 } ) ;
9171
92- it ( " contains the application config" , function ( ) {
93- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
72+ it ( ' contains the application config' , function ( ) {
73+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
9474
95- let config = pkg . fastboot . config [ " basic-app" ] ;
75+ let config = pkg . fastboot . config [ ' basic-app' ] ;
9676
9777 expect ( config . APP . version ) . to . be ;
9878
9979 delete config . APP . version ;
10080 expect ( config ) . to . deep . equal ( {
101- modulePrefix : " basic-app" ,
102- environment : " development" ,
103- rootURL : "/" ,
104- locationType : " auto" ,
81+ modulePrefix : ' basic-app' ,
82+ environment : ' development' ,
83+ rootURL : '/' ,
84+ locationType : ' auto' ,
10585 EmberENV : {
10686 EXTEND_PROTOTYPES : {
10787 Date : false ,
@@ -113,45 +93,40 @@ describe("generating package.json", function () {
11393 _TEMPLATE_ONLY_GLIMMER_COMPONENTS : true ,
11494 } ,
11595 APP : {
116- name : " basic-app" ,
96+ name : ' basic-app' ,
11797 autoboot : false ,
11898 } ,
11999 fastboot : {
120- hostWhitelist : [
121- "example.com" ,
122- "subdomain.example.com" ,
123- "/localhost:\\d+/" ,
124- ] ,
100+ hostWhitelist : [ 'example.com' , 'subdomain.example.com' , '/localhost:\\d+/' ] ,
125101 } ,
126102 exportApplicationGlobal : true ,
127103 } ) ;
128104 } ) ;
129105
130- it ( " contains additional config from example-addon" , function ( ) {
131- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
106+ it ( ' contains additional config from example-addon' , function ( ) {
107+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
132108
133- expect ( pkg . fastboot . config [ " foo" ] ) . to . equal ( " bar" ) ;
109+ expect ( pkg . fastboot . config [ ' foo' ] ) . to . equal ( ' bar' ) ;
134110 } ) ;
135-
136111 } ) ;
137112
138- describe ( " with production FastBoot builds" , function ( ) {
139- before ( async function ( ) {
140- await execa ( " yarn" , [ " build" , " --environment=production" ] ) ;
113+ describe ( ' with production FastBoot builds' , function ( ) {
114+ before ( async function ( ) {
115+ await execa ( ' yarn' , [ ' build' , ' --environment=production' ] ) ;
141116 } ) ;
142117
143- it ( " contains a manifest of FastBoot assets" , function ( ) {
144- let pkg = fs . readJSONSync ( " dist/package.json" ) ;
118+ it ( ' contains a manifest of FastBoot assets' , function ( ) {
119+ let pkg = fs . readJSONSync ( ' dist/package.json' ) ;
145120
146121 let manifest = pkg . fastboot . manifest ;
147122
148- manifest . appFiles . forEach ( ( file ) => {
123+ manifest . appFiles . forEach ( file => {
149124 expect ( `dist/${ file } ` ) . to . be . a . file ( ) ;
150125 } ) ;
151126
152127 expect ( `dist/${ manifest . htmlFile } ` ) . to . be . a . file ( ) ;
153128
154- manifest . vendorFiles . forEach ( ( file ) => {
129+ manifest . vendorFiles . forEach ( file => {
155130 expect ( `dist/${ file } ` ) . to . be . a . file ( ) ;
156131 } ) ;
157132 } ) ;
0 commit comments