Skip to content

Commit

Permalink
RecordData errors
Browse files Browse the repository at this point in the history
  • Loading branch information
igorT committed Jun 29, 2019
1 parent b4ba675 commit 73c1661
Show file tree
Hide file tree
Showing 37 changed files with 1,025 additions and 363 deletions.
12 changes: 9 additions & 3 deletions bin/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ function getConfig() {
}
if (!['release', 'beta', 'canary', 'lts'].includes(mainOptions.channel)) {
throw new Error(
`Incorrect usage of publish:\n\tpublish <channel>\n\nChannel must be one of release|beta|canary|lts. Received ${mainOptions.channel}`
`Incorrect usage of publish:\n\tpublish <channel>\n\nChannel must be one of release|beta|canary|lts. Received ${
mainOptions.channel
}`
);
}

Expand Down Expand Up @@ -162,7 +164,9 @@ function assertGitIsClean() {
if (options.force) {
console.log(
chalk.white(
`⚠️ ⚠️ ⚠️ Expected to publish npm tag ${options.distTag} from the git branch ${expectedChannelBranch}, but found ${foundBranch}`
`⚠️ ⚠️ ⚠️ Expected to publish npm tag ${
options.distTag
} from the git branch ${expectedChannelBranch}, but found ${foundBranch}`
) +
chalk.yellow('\n\tPassed option: ') +
chalk.white('--force') +
Expand All @@ -171,7 +175,9 @@ function assertGitIsClean() {
} else {
console.log(
chalk.red(
`💥 Expected to publish npm tag ${options.distTag} from the git branch ${expectedChannelBranch}, but found ${foundBranch} 💥 \n\t`
`💥 Expected to publish npm tag ${
options.distTag
} from the git branch ${expectedChannelBranch}, but found ${foundBranch} 💥 \n\t`
) +
chalk.grey('Use ') +
chalk.white('--force') +
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:node": "lerna run test:node",
"test:production": "yarn workspace ember-data test:production",
"test:try-one": "yarn workspace ember-data test:try-one",
"test:enabled-in-progress-features": "yarn workspace ember-data test --enable-in-progress",
"test:enabled-in-progress-features": "yarn workspace ember-data test:optional-features",
"test-external:ember-m3": "./bin/test-external-partner-project.js ember-m3 https://github.com/hjdivad/ember-m3.git",
"test-external:ember-data-change-tracker": "./bin/test-external-partner-project.js ember-data-change-tracker https://github.com/danielspaniel/ember-data-change-tracker.git",
"test-external:model-fragments": "./bin/test-external-partner-project.js ember-data-model-fragments https://github.com/lytics/ember-data-model-fragments.git",
Expand Down
12 changes: 1 addition & 11 deletions packages/-build-infra/src/debug-macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ module.exports = function debugMacros(environment) {
flags: [
{
source: '@ember-data/canary-features',
flags: Object.assign(
// explicit list of additional exports within @ember-data/canary-features
// without adding this (with a null value) an error is thrown during
// the feature replacement process (e.g. XYZ is not a supported flag)
{
FEATURES: null,
DEFAULT_FEATURES: null,
isEnabled: null,
},
FEATURES
),
flags: FEATURES,
},
],
},
Expand Down
29 changes: 23 additions & 6 deletions packages/-build-infra/src/features.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
'use strict';

function getFeatures() {
const features = { SAMPLE_FEATURE_FLAG: null };
let enableFeatures = process.env.EMBER_DATA_FEATURES;
// turn on all features when given the above environment variable
if (enableFeatures) {
for (let key in features) {
features[key] = true;
const features = {
SAMPLE_FEATURE_FLAG: null,
RECORD_DATA_ERRORS: null,
};

const FEATURE_OVERRIDES = process.env.EMBER_DATA_FEATURE_OVERRIDE;
if (FEATURE_OVERRIDES === 'ENABLE_ALL_OPTIONAL') {
// enable all features with a current value of `null`
for (let feature in features) {
let featureValue = features[feature];

if (featureValue === null) {
features[feature] = true;
}
}
} else if (FEATURE_OVERRIDES) {
// enable only the specific features listed in the environment
// variable (comma separated)
const forcedFeatures = FEATURE_OVERRIDES.split(',');
for (var i = 0; i < forcedFeatures.length; i++) {
let featureName = forcedFeatures[i];

features[featureName] = true;
}
}

Expand Down
5 changes: 5 additions & 0 deletions packages/-ember-data/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
let app = new EmberAddon(defaults, {
babel: {
// this ensures that the same `@ember-data/canary-features` processing that the various
// ember-data addons do is done in the dummy app
plugins: [...require('@ember-data/-build-infra/src/debug-macros')()],
},
'ember-cli-babel': {
throwUnlessParallelizable: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "ember test",
"test:all": "ember try:each",
"test:production": "ember test -e production",
"test:optional-features": "ember test -e test-optional-features",
"test:optional-features": "EMBER_DATA_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember test",
"test:try-one": "ember try:one",
"prepublishOnly": "ember build --environment=production && ember ts:precompile",
"postpublish": "ember ts:clean"
Expand Down
4 changes: 3 additions & 1 deletion packages/-ember-data/tests/helpers/watch-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ QUnit.assert.watchedPropertyCounts = function assertWatchedPropertyCount(
expectedCount = expectedCount[0];
}

assertionText += ` | Expected ${expectedCount} change notifications for ${propertyName} but recieved ${counter.count}`;
assertionText += ` | Expected ${expectedCount} change notifications for ${propertyName} but recieved ${
counter.count
}`;

if (counter === undefined) {
throw new Error(
Expand Down
8 changes: 8 additions & 0 deletions packages/-ember-data/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
<script src="/testem.js" integrity=""></script>
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/test-support.js"></script>

<script>
// Handle testing feature flags
if (QUnit.urlParams.enableoptionalfeatures) {
window.EmberDataENV = { ENABLE_OPTIONAL_FEATURES: true };
}
</script>

<script src="{{rootURL}}assets/dummy.js"></script>
<script src="{{rootURL}}assets/tests.js"></script>

Expand Down
Loading

0 comments on commit 73c1661

Please sign in to comment.