1
- " use strict" ;
1
+ ' use strict' ;
2
2
3
- const chai = require ( " chai" ) ;
3
+ const chai = require ( ' chai' ) ;
4
4
const 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' ) ;
7
7
8
- chai . use ( require ( " chai-fs" ) ) ;
8
+ chai . use ( require ( ' chai-fs' ) ) ;
9
9
10
- describe ( " generating package.json" , function ( ) {
10
+ describe ( ' generating package.json' , function ( ) {
11
11
this . timeout ( 300000 ) ;
12
12
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' ] ) ;
16
16
} ) ;
17
17
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 ( ) ;
21
21
} ) ;
22
22
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' ) ;
25
25
26
26
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' ,
33
31
} ) ;
34
32
} ) ;
35
33
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' ) ;
38
36
39
37
expect ( pkg . fastboot . schemaVersion ) . to . deep . equal ( 3 ) ;
40
38
} ) ;
41
39
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' ] ) ;
55
44
} ) ;
56
45
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' ) ;
59
48
60
49
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' ] ,
73
53
} ) ;
74
54
} ) ;
75
55
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' ) ;
78
58
79
59
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+/' ,
83
63
] ) ;
84
64
} ) ;
85
65
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' ) ;
88
68
89
- expect ( pkg . fastboot . appName ) . to . equal ( " basic-app" ) ;
69
+ expect ( pkg . fastboot . appName ) . to . equal ( ' basic-app' ) ;
90
70
} ) ;
91
71
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' ) ;
94
74
95
- let config = pkg . fastboot . config [ " basic-app" ] ;
75
+ let config = pkg . fastboot . config [ ' basic-app' ] ;
96
76
97
77
expect ( config . APP . version ) . to . be ;
98
78
99
79
delete config . APP . version ;
100
80
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' ,
105
85
EmberENV : {
106
86
EXTEND_PROTOTYPES : {
107
87
Date : false ,
@@ -113,45 +93,40 @@ describe("generating package.json", function () {
113
93
_TEMPLATE_ONLY_GLIMMER_COMPONENTS : true ,
114
94
} ,
115
95
APP : {
116
- name : " basic-app" ,
96
+ name : ' basic-app' ,
117
97
autoboot : false ,
118
98
} ,
119
99
fastboot : {
120
- hostWhitelist : [
121
- "example.com" ,
122
- "subdomain.example.com" ,
123
- "/localhost:\\d+/" ,
124
- ] ,
100
+ hostWhitelist : [ 'example.com' , 'subdomain.example.com' , '/localhost:\\d+/' ] ,
125
101
} ,
126
102
exportApplicationGlobal : true ,
127
103
} ) ;
128
104
} ) ;
129
105
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' ) ;
132
108
133
- expect ( pkg . fastboot . config [ " foo" ] ) . to . equal ( " bar" ) ;
109
+ expect ( pkg . fastboot . config [ ' foo' ] ) . to . equal ( ' bar' ) ;
134
110
} ) ;
135
-
136
111
} ) ;
137
112
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' ] ) ;
141
116
} ) ;
142
117
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' ) ;
145
120
146
121
let manifest = pkg . fastboot . manifest ;
147
122
148
- manifest . appFiles . forEach ( ( file ) => {
123
+ manifest . appFiles . forEach ( file => {
149
124
expect ( `dist/${ file } ` ) . to . be . a . file ( ) ;
150
125
} ) ;
151
126
152
127
expect ( `dist/${ manifest . htmlFile } ` ) . to . be . a . file ( ) ;
153
128
154
- manifest . vendorFiles . forEach ( ( file ) => {
129
+ manifest . vendorFiles . forEach ( file => {
155
130
expect ( `dist/${ file } ` ) . to . be . a . file ( ) ;
156
131
} ) ;
157
132
} ) ;
0 commit comments