@@ -11,170 +11,6 @@ chai.use(require('chai-fs'));
1111describe ( 'generating package.json' , function ( ) {
1212 this . timeout ( 300000 ) ;
1313
14- let app ;
15-
16- before ( function ( ) {
17- app = new AddonTestApp ( ) ;
18-
19- return app . create ( 'module-whitelist' , {
20- skipNpm : true
21- } )
22- . then ( addFastBootDeps )
23- . then ( function ( ) {
24- return app . run ( 'npm' , 'install' ) ;
25- } ) ;
26- } ) ;
27-
28- describe ( 'with FastBoot builds' , function ( ) {
29-
30- before ( function ( ) {
31- return app . runEmberCommand ( 'build' ) ;
32- } ) ;
33-
34- it ( 'builds a package.json' , function ( ) {
35- expect ( app . filePath ( 'dist/package.json' ) ) . to . be . a . file ( ) ;
36- } ) ;
37-
38- it ( 'merges FastBoot dependencies from multiple addons' , function ( ) {
39- let config = fs . readJsonSync ( app . filePath ( '/dist/package.json' ) ) ;
40-
41- expect ( config . dependencies ) . to . deep . equal ( {
42- 'foo' : '1.0.0' ,
43- 'bar' : '^0.1.2' ,
44- 'baz' : '0.0.0' ,
45- "najax" : "^1.0.3" ,
46- 'rsvp' : '3.2.1'
47- } ) ;
48- } ) ;
49-
50- it ( 'contains a schema version' , function ( ) {
51- let pkg = fs . readJsonSync ( app . filePath ( '/dist/package.json' ) ) ;
52-
53- expect ( pkg . fastboot . schemaVersion ) . to . deep . equal ( 3 ) ;
54- } ) ;
55-
56- it ( 'contains a whitelist of allowed module names' , function ( ) {
57- let pkg = fs . readJsonSync ( app . filePath ( '/dist/package.json' ) ) ;
58-
59- expect ( pkg . fastboot . moduleWhitelist ) . to . deep . equal ( [
60- 'najax' ,
61- 'url' ,
62- 'path' ,
63- 'foo' ,
64- 'bar' ,
65- 'baz' ,
66- 'rsvp'
67- ] ) ;
68- } ) ;
69-
70- it ( 'contains a manifest of FastBoot assets' , function ( ) {
71- let pkg = fs . readJsonSync ( app . filePath ( '/dist/package.json' ) ) ;
72-
73- expect ( pkg . fastboot . manifest ) . to . deep . equal ( {
74- appFiles : [ 'assets/module-whitelist.js' , 'assets/module-whitelist-fastboot.js' , 'ember-fastboot-build-example/bar.js' ] ,
75- htmlFile : 'index.html' ,
76- vendorFiles : [ 'ember-fastboot-build-example/foo.js' , 'assets/vendor.js' ]
77- } ) ;
78- } ) ;
79-
80- it ( 'contains a list of whitelisted hosts from environment.js' , function ( ) {
81- let pkg = fs . readJsonSync ( app . filePath ( 'dist/package.json' ) ) ;
82-
83- expect ( pkg . fastboot . hostWhitelist ) . to . deep . equal ( [
84- 'example.com' ,
85- 'subdomain.example.com' ,
86- '/localhost:\\d+/'
87- ] ) ;
88- } ) ;
89-
90- it ( 'contains app name' , function ( ) {
91- let pkg = fs . readJsonSync ( app . filePath ( 'dist/package.json' ) ) ;
92-
93- expect ( pkg . fastboot . appName ) . to . equal ( 'module-whitelist' ) ;
94- } ) ;
95-
96- it ( 'contains the application config' , function ( ) {
97- let pkg = fs . readJsonSync ( app . filePath ( 'dist/package.json' ) ) ;
98-
99- expect ( pkg . fastboot . config [ 'module-whitelist' ] ) . to . deep . equal ( {
100- modulePrefix : 'module-whitelist' ,
101- environment : 'development' ,
102- baseURL : '/' ,
103- locationType : 'auto' ,
104- EmberENV : { FEATURES : { } } ,
105- APP : { name : 'module-whitelist' , version : '0.0.0' , autoboot : false } ,
106- fastboot : { hostWhitelist : [ 'example.com' , 'subdomain.example.com' , '/localhost:\\d+/' ] } ,
107- exportApplicationGlobal : true
108- } ) ;
109- } ) ;
110-
111- it ( 'contains additional config from ember-fastboot-build-example addon' , function ( ) {
112- let pkg = fs . readJsonSync ( app . filePath ( 'dist/package.json' ) ) ;
113-
114- expect ( pkg . fastboot . config [ 'foo' ] ) . to . equal ( 'bar' ) ;
115- } ) ;
116-
117- describe ( 'with addon that implements fastbootConfigTree' , function ( ) {
118- let app ;
119-
120- before ( function ( ) {
121- app = new AddonTestApp ( ) ;
122-
123- return app . create ( 'fastboot-config' , {
124- skipNpm : true
125- } )
126- . then ( addFastBootDeps )
127- . then ( function ( ) {
128- return app . run ( 'npm' , 'install' ) ;
129- } )
130- . then ( function ( ) {
131- return app . runEmberCommand ( 'build' ) ;
132- } ) ;
133- } ) ;
134-
135- it ( 'it extends the application config' , function ( ) {
136- let pkg = fs . readJsonSync ( app . filePath ( 'dist/package.json' ) ) ;
137-
138- expect ( pkg . fastboot . config [ 'fastboot-config' ] ) . to . deep . equal ( {
139- foo : 'bar' ,
140- modulePrefix : 'fastboot-config' ,
141- environment : 'development' ,
142- baseURL : '/' ,
143- locationType : 'auto' ,
144- EmberENV : { FEATURES : { } } ,
145- APP : { name : 'fastboot-config' , version : '0.0.0' , autoboot : false } ,
146- fastboot : { hostWhitelist : [ 'example.com' , 'subdomain.example.com' , '/localhost:\\d+/' ] } ,
147- exportApplicationGlobal : true
148- } ) ;
149- } ) ;
150- } ) ;
151- } ) ;
152-
153- describe ( 'with production FastBoot builds' , function ( ) {
154-
155- before ( function ( ) {
156- return app . runEmberCommand ( 'build' , '--environment=production' ) ;
157- } ) ;
158-
159- it ( 'contains a manifest of FastBoot assets' , function ( ) {
160- let pkg = fs . readJsonSync ( app . filePath ( '/dist/package.json' ) ) ;
161-
162- let p = function ( filePath ) {
163- return app . filePath ( path . join ( 'dist' , filePath ) ) ;
164- } ;
165-
166- let manifest = pkg . fastboot . manifest ;
167-
168- manifest . appFiles . forEach ( function ( file ) {
169- expect ( p ( file ) ) . to . be . a . file ( ) ;
170- } ) ;
171- expect ( p ( manifest . htmlFile ) ) . to . be . a . file ( ) ;
172- manifest . vendorFiles . forEach ( function ( file ) {
173- expect ( p ( file ) ) . to . be . a . file ( ) ;
174- } ) ;
175- } ) ;
176- } ) ;
177-
17814 describe ( 'with customized fingerprinting options' , function ( ) {
17915 // Tests an app with a custom `assetMapPath` set
18016 let customApp = new AddonTestApp ( ) ;
@@ -276,14 +112,3 @@ describe('generating package.json', function() {
276112 } ) ;
277113} ) ;
278114
279- function addFastBootDeps ( app ) {
280- return app . editPackageJSON ( pkg => {
281- pkg [ 'devDependencies' ] [ 'fake-addon' ] = `*` ;
282- pkg [ 'devDependencies' ] [ 'fake-addon-2' ] = `*` ;
283- pkg [ 'fastbootDependencies' ] = [ "rsvp" ] ;
284- pkg [ 'dependencies' ] = {
285- rsvp : '3.2.1' ,
286- 'ember-fastboot-build-example' : '0.1.2'
287- } ;
288- } ) ;
289- }
0 commit comments