From 919eca3b11de4e69ef70297f053e5dcc99a7063d Mon Sep 17 00:00:00 2001 From: Gaurav Munjal Date: Tue, 23 Jul 2019 20:31:33 -0400 Subject: [PATCH] [BUGFIX RELEASE] Fix generating from blueprints (#6274) * [BUGFIX RELEASE] Fix generating from blueprints * Revert "skip node tests" This reverts commit db5cac2257578c635d9dbdc118f8c946dc684a83. * fix failing node tests * fix prettier eslint * blueprintPath -> root * fix eslint prettier again --- .travis.yml | 7 +++---- azure-pipelines.yml | 7 +++---- packages/-build-infra/src/utilities/edition-detector.js | 2 +- .../-build-infra/src/utilities/test-framework-detector.js | 8 ++++---- packages/adapter/blueprints/adapter-test/index.js | 2 ++ packages/adapter/blueprints/adapter/index.js | 2 ++ packages/model/blueprints/model-test/index.js | 2 ++ packages/model/blueprints/model/index.js | 2 ++ packages/serializer/blueprints/serializer-test/index.js | 2 ++ packages/serializer/blueprints/serializer/index.js | 2 ++ packages/serializer/blueprints/transform-test/index.js | 2 ++ packages/serializer/blueprints/transform/index.js | 2 ++ 12 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff582ada621..dfcafdebfa1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,10 +65,9 @@ jobs: env: TARGET_IE11=true script: yarn test - # See https://github.com/emberjs/data/pull/6241 - # - name: 'Node Tests' - # install: yarn install - # script: yarn test:node + - name: 'Node Tests' + install: yarn install + script: yarn test:node # runs tests against each supported Ember version - stage: ember version tests diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b900c2073c1..c8b3715e80b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -76,10 +76,9 @@ jobs: TARGET_IE11=true yarn test displayName: 'Max transpilation Tests' - # See https://github.com/emberjs/data/pull/6241 - # - script: | - # yarn test:node - # displayName: 'Node Tests' + - script: | + yarn test:node + displayName: 'Node Tests' - script: | yarn test:try-one with-ember-fetch diff --git a/packages/-build-infra/src/utilities/edition-detector.js b/packages/-build-infra/src/utilities/edition-detector.js index 9c62029c700..6739750b2b1 100644 --- a/packages/-build-infra/src/utilities/edition-detector.js +++ b/packages/-build-infra/src/utilities/edition-detector.js @@ -5,7 +5,7 @@ const path = require('path'); module.exports = function(blueprint) { blueprint.filesPath = function() { let rootPath = process.env.EMBER_VERSION === 'OCTANE' ? 'native-files' : 'files'; - return path.join(this.path, rootPath); + return path.join(blueprint.root, rootPath); }; return blueprint; diff --git a/packages/-build-infra/src/utilities/test-framework-detector.js b/packages/-build-infra/src/utilities/test-framework-detector.js index 181291750fd..f24b0148d94 100644 --- a/packages/-build-infra/src/utilities/test-framework-detector.js +++ b/packages/-build-infra/src/utilities/test-framework-detector.js @@ -15,7 +15,7 @@ module.exports = function(blueprint) { let dependencies = this.project.dependencies(); if ('ember-qunit' in dependencies) { - if (fs.existsSync(this.path + '/qunit-rfc-232-files')) { + if (fs.existsSync(blueprint.root + '/qunit-rfc-232-files')) { type = 'qunit-rfc-232'; } else { type = 'qunit'; @@ -23,7 +23,7 @@ module.exports = function(blueprint) { } else if ('ember-cli-qunit' in dependencies) { let checker = new VersionChecker(this.project); if ( - fs.existsSync(this.path + '/qunit-rfc-232-files') && + fs.existsSync(blueprint.root + '/qunit-rfc-232-files') && checker.for('ember-cli-qunit', 'npm').gte('4.2.0') ) { type = 'qunit-rfc-232'; @@ -33,7 +33,7 @@ module.exports = function(blueprint) { } else if ('ember-mocha' in dependencies) { let checker = new VersionChecker(this.project); if ( - fs.existsSync(this.path + '/mocha-rfc-232-files') && + fs.existsSync(blueprint.root + '/mocha-rfc-232-files') && checker.for('ember-mocha', 'npm').gte('0.14.0') ) { type = 'mocha-rfc-232'; @@ -47,7 +47,7 @@ module.exports = function(blueprint) { type = 'qunit'; } - return path.join(this.path, type + '-files'); + return path.join(blueprint.root, type + '-files'); }; return blueprint; diff --git a/packages/adapter/blueprints/adapter-test/index.js b/packages/adapter/blueprints/adapter-test/index.js index 98a6f4b19d2..59bdfef210b 100644 --- a/packages/adapter/blueprints/adapter-test/index.js +++ b/packages/adapter/blueprints/adapter-test/index.js @@ -7,6 +7,8 @@ const path = require('path'); module.exports = useTestFrameworkDetector({ description: 'Generates an ember-data adapter unit test', + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/adapter/blueprints/adapter/index.js b/packages/adapter/blueprints/adapter/index.js index 21d24323973..6611d093b2c 100644 --- a/packages/adapter/blueprints/adapter/index.js +++ b/packages/adapter/blueprints/adapter/index.js @@ -9,6 +9,8 @@ module.exports = useEditionDetector({ availableOptions: [{ name: 'base-class', type: String }], + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/model/blueprints/model-test/index.js b/packages/model/blueprints/model-test/index.js index 65439c05a2e..70cbd96b723 100644 --- a/packages/model/blueprints/model-test/index.js +++ b/packages/model/blueprints/model-test/index.js @@ -8,6 +8,8 @@ const path = require('path'); module.exports = useTestFrameworkDetector({ description: 'Generates a model unit test.', + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/model/blueprints/model/index.js b/packages/model/blueprints/model/index.js index af5eda19141..64ac64d2d21 100644 --- a/packages/model/blueprints/model/index.js +++ b/packages/model/blueprints/model/index.js @@ -11,6 +11,8 @@ module.exports = useEditionDetector({ anonymousOptions: ['name', 'attr:type'], + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/serializer/blueprints/serializer-test/index.js b/packages/serializer/blueprints/serializer-test/index.js index 823a6280838..8efb0067335 100644 --- a/packages/serializer/blueprints/serializer-test/index.js +++ b/packages/serializer/blueprints/serializer-test/index.js @@ -7,6 +7,8 @@ const path = require('path'); module.exports = useTestFrameworkDetector({ description: 'Generates a serializer unit test.', + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/serializer/blueprints/serializer/index.js b/packages/serializer/blueprints/serializer/index.js index 46f03779589..fa0cbf4c00f 100644 --- a/packages/serializer/blueprints/serializer/index.js +++ b/packages/serializer/blueprints/serializer/index.js @@ -9,6 +9,8 @@ module.exports = useEditionDetector({ availableOptions: [{ name: 'base-class', type: String }], + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/serializer/blueprints/transform-test/index.js b/packages/serializer/blueprints/transform-test/index.js index bb38cc04f5f..f618ce8a92c 100644 --- a/packages/serializer/blueprints/transform-test/index.js +++ b/packages/serializer/blueprints/transform-test/index.js @@ -7,6 +7,8 @@ const path = require('path'); module.exports = useTestFrameworkDetector({ description: 'Generates a transform unit test.', + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return { diff --git a/packages/serializer/blueprints/transform/index.js b/packages/serializer/blueprints/transform/index.js index 3caf67e8a74..4d7c05e8dc3 100644 --- a/packages/serializer/blueprints/transform/index.js +++ b/packages/serializer/blueprints/transform/index.js @@ -6,6 +6,8 @@ const useEditionDetector = require('@ember-data/-build-infra/src/utilities/editi module.exports = useEditionDetector({ description: 'Generates an ember-data value transform.', + root: __dirname, + fileMapTokens(options) { if (isModuleUnificationProject(this.project)) { return {