diff --git a/ember-cli-build.js b/ember-cli-build.js index 998555ff1..d9549ca12 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -32,32 +32,39 @@ codemirrorAssets = function () { return {import: codemirrorFiles}; } - return { - public: { - include: codemirrorFiles, - destDir: '/', - processTree(tree) { - let jsTree = concat(tree, { - outputFile: 'assets/codemirror/codemirror.js', - headerFiles: ['lib/codemirror.js'], - inputFiles: ['mode/**/*'], - sourceMapConfig: {enabled: false} - }); + let config = {}; - let cssTree = concat(tree, { - outputFile: 'assets/codemirror/codemirror.css', - inputFiles: ['**/*.css'] - }); + config.public = { + include: codemirrorFiles, + destDir: '/', + processTree(tree) { + let jsTree = concat(tree, { + outputFile: 'assets/codemirror/codemirror.js', + headerFiles: ['lib/codemirror.js'], + inputFiles: ['mode/**/*'], + sourceMapConfig: {enabled: false} + }); - if (isProduction) { - jsTree = uglify(jsTree); - cssTree = new CleanCSS(cssTree); - } + let cssTree = concat(tree, { + outputFile: 'assets/codemirror/codemirror.css', + inputFiles: ['**/*.css'] + }); - return mergeTrees([jsTree, cssTree]); + if (isProduction) { + jsTree = uglify(jsTree); + cssTree = new CleanCSS(cssTree); } + + return mergeTrees([tree, jsTree, cssTree]); } }; + + // put the files in vendor ready for importing into the test-support file + if (environment === 'development') { + config.vendor = codemirrorFiles; + } + + return config; }; function postcssPlugins() { @@ -177,9 +184,15 @@ module.exports = function (defaults) { app.import('bower_components/google-caja/html-css-sanitizer-bundle.js'); app.import('bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js'); - if (app.env === 'test') { + if (app.env !== 'production') { app.import(`${app.bowerDirectory}/jquery.simulate.drag-sortable/jquery.simulate.drag-sortable.js`, {type: 'test'}); } + // pull things we rely on via lazy-loading into the test-support.js file so + // that tests don't break when running via http://localhost:4200/tests + if (app.env === 'development') { + app.import('vendor/codemirror/lib/codemirror.js', {type: 'test'}); + } + return app.toTree(); }; diff --git a/mirage/fixtures/configurations.js b/mirage/fixtures/configurations.js index e12c9ad05..e939943e6 100644 --- a/mirage/fixtures/configurations.js +++ b/mirage/fixtures/configurations.js @@ -1,6 +1,6 @@ export default [{ blogTitle: 'Test Blog', - blogUrl: 'http://localhost:7357/', + blogUrl: `${window.location.origin}/`, clientId: 'ghost-admin', clientSecret: '1234ClientSecret', fileStorage: 'true', diff --git a/package.json b/package.json index b885e13cd..917342319 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "ember-cli-inject-live-reload": "1.6.1", "ember-cli-mirage": "0.2.8", "ember-cli-mocha": "0.13.2", - "ember-cli-node-assets": "0.1.6", + "ember-cli-node-assets": "0.2.2", "ember-cli-postcss": "3.2.0", "ember-cli-pretender": "1.0.1", "ember-cli-selectize": "0.5.12", diff --git a/yarn.lock b/yarn.lock index 7663c06fe..001003c8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2438,7 +2438,18 @@ ember-cli-mocha@0.13.2: mocha "^2.5.3" resolve "^1.1.7" -ember-cli-node-assets@0.1.6, ember-cli-node-assets@^0.1.4: +ember-cli-node-assets@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/ember-cli-node-assets/-/ember-cli-node-assets-0.2.2.tgz#d2d55626e7cc6619f882d7fe55751f9266022708" + dependencies: + broccoli-funnel "^1.0.1" + broccoli-merge-trees "^1.1.1" + broccoli-source "^1.1.0" + debug "^2.2.0" + lodash "^4.5.1" + resolve "^1.1.7" + +ember-cli-node-assets@^0.1.4: version "0.1.6" resolved "https://registry.yarnpkg.com/ember-cli-node-assets/-/ember-cli-node-assets-0.1.6.tgz#6488a2949048c801ad6d9e33753c7bce32fc1146" dependencies: