Skip to content

Commit 3ab9370

Browse files
committed
Fix blueprint tests
1 parent bf3d38d commit 3ab9370

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

ts/tests/blueprints/ember-cli-typescript-test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ import helpers from 'ember-cli-blueprint-test-helpers/helpers';
66
import chaiHelpers from 'ember-cli-blueprint-test-helpers/chai';
77
import Blueprint from 'ember-cli/lib/models/blueprint';
88

9+
import { setupPublishedVersionStashing } from '../helpers/stash-published-version';
910
import ects from '../../blueprints/ember-cli-typescript/index';
1011

1112
const expect = chaiHelpers.expect;
1213
const file = chaiHelpers.file;
1314

1415
describe('Acceptance: ember-cli-typescript generator', function () {
16+
setupPublishedVersionStashing(this);
17+
1518
helpers.setupTestHooks(this, {
1619
disabledTasks: ['addon-install', 'bower-install'],
1720
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import fs from 'fs-extra';
2+
3+
const PACKAGE_PATH = 'node_modules/ember-cli-typescript';
4+
5+
/**
6+
* We have assorted devDependencies that themselves depend on `ember-cli-typescript`.
7+
* This means we have a published copy of the addon present in `node_modules` normally,
8+
* though `ember-cli-blueprint-test-helpers` fiddles around in there as well.
9+
*
10+
* This helper ensures we move the published version of the addon out of the way into
11+
* an inert location during the enclosing `describe` block and put it back afterwards.
12+
*/
13+
export function setupPublishedVersionStashing(hooks: Mocha.Suite): void {
14+
hooks.beforeAll(async () => {
15+
await fs.move(PACKAGE_PATH, `${PACKAGE_PATH}.published`);
16+
});
17+
18+
hooks.afterAll(async () => {
19+
await fs.move(`${PACKAGE_PATH}.published`, PACKAGE_PATH);
20+
});
21+
}

0 commit comments

Comments
 (0)