forked from ember-fastboot/ember-cli-fastboot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-json-test.js
More file actions
59 lines (50 loc) · 1.89 KB
/
package-json-test.js
File metadata and controls
59 lines (50 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* eslint-disable no-undef */
'use strict';
const chai = require('chai');
const expect = chai.expect;
const fs = require('fs-extra');
const path = require('path');
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
chai.use(require('chai-fs'));
describe('generating package.json', function () {
this.timeout(300000);
describe('with customized outputPaths options', function () {
// Tests an app with a custom `outputPaths` set
let customApp = new AddonTestApp();
before(function () {
return customApp
.create('customized-outputpaths', {
emberVersion: '~3.28.12',
emberDataVersion: '~3.28.12',
})
.then(function () {
customApp.editPackageJSON((pkg) => {
delete pkg.devDependencies['ember-fetch'];
delete pkg.devDependencies['ember-welcome-page'];
// needed because @ember-data/store does `FastBoot.require('crypto')`
pkg.fastbootDependencies = ['node-fetch', 'path', 'crypto'];
});
return customApp.run('npm', 'install');
})
.then(function () {
return customApp.runEmberCommand('build');
});
});
it('respects custom output paths and maps to them in the manifest', function () {
function p(filePath) {
return customApp.filePath(path.join('dist', filePath));
}
let pkg = fs.readJsonSync(customApp.filePath('/dist/package.json'));
let manifest = pkg.fastboot.manifest;
expect(manifest.appFiles).to.include('some-assets/path/app-file.js');
manifest.appFiles.forEach(function (file) {
expect(p(file)).to.be.a.file();
});
expect(p(manifest.htmlFile)).to.be.a.file();
expect(manifest.vendorFiles).to.include('some-assets/path/lib.js');
manifest.vendorFiles.forEach(function (file) {
expect(p(file)).to.be.a.file();
});
});
});
});