Skip to content

Commit

Permalink
Merge pull request #117 from miguelcobain/handle-no-config
Browse files Browse the repository at this point in the history
Handle no ownConfig scenario (for real)
  • Loading branch information
SergeAstapov authored Nov 18, 2022
2 parents d963b93 + 9aec22e commit 7d8c677
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
24 changes: 14 additions & 10 deletions ember-css-transitions/src/modifiers/css-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ import { buildWaiter } from '@ember/test-waiters';

import { nextTick, sleep, computeTimeout } from '../utils/transition-utils';

const waiter = (getOwnConfig() || {}).useTestWaiters
? buildWaiter('ember-css-transitions')
: {
beginAsync() {
/* fake */
},
endAsync() {
/* fake */
},
};
let waiter;

if (macroCondition(getOwnConfig()?.useTestWaiters)) {
waiter = buildWaiter('ember-css-transitions');
} else {
waiter = {
beginAsync() {
/* fake */
},
endAsync() {
/* fake */
},
};
}

let modifier;

Expand Down
23 changes: 18 additions & 5 deletions test-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function (defaults) {
const app = new EmberApp(defaults, {
autoImport: {
watchDependencies: ['ember-css-transitions'],
},
let macrosConfig;

// Intentionally not add macros config if env variable not set
// so that we test in CI all the scenarios:
// - USE_TEST_WAITERS=true
// - USE_TEST_WAITERS=false
// - USE_TEST_WAITERS not set
if (process.env.USE_TEST_WAITERS !== undefined) {
macrosConfig = {
'@embroider/macros': {
setConfig: {
'ember-css-transitions': {
useTestWaiters: process.env.USE_TEST_WAITERS !== 'false',
},
},
},
};
}

module.exports = function (defaults) {
const app = new EmberApp(defaults, {
autoImport: {
watchDependencies: ['ember-css-transitions'],
},
...macrosConfig,
});

// Use `app.import` to add additional libraries to the generated
Expand Down

0 comments on commit 7d8c677

Please sign in to comment.