Skip to content

Commit 8556ab5

Browse files
author
Kelly Selden
committed
skip npm install in addon test
1 parent 3b4b856 commit 8556ab5

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

test/acceptance/ember-addon-test.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
const fs = require('fs-extra');
4+
const path = require('path');
35
const { describe, it } = require('../helpers/mocha');
46
const { expect } = require('../helpers/chai');
57
const {
@@ -12,11 +14,10 @@ const {
1214
assertNormalUpdate,
1315
assertNoUnstaged
1416
} = require('../helpers/assertions');
15-
const run = require('../../src/run');
1617
const mutatePackageJson = require('boilerplate-update/src/mutate-package-json');
1718

1819
describe(function() {
19-
this.timeout(3 * 60 * 1000);
20+
this.timeout(30 * 1000);
2021

2122
let tmpPath;
2223

@@ -59,17 +60,32 @@ describe(function() {
5960
}
6061

6162
it('works', async function() {
63+
let before;
64+
6265
let {
6366
status
6467
} = await merge({
6568
fixturesPath: 'test/fixtures/app/local',
6669
commitMessage: 'my-app',
6770
async beforeMerge() {
6871
await mutatePackageJson(tmpPath, pkg => {
69-
pkg.devDependencies['ember-cli-update'] = '*';
72+
before = pkg.devDependencies;
73+
pkg.devDependencies = {
74+
'ember-cli': before['ember-cli'],
75+
'ember-cli-update': ''
76+
};
7077
});
7178

72-
await run('npm install --no-package-lock', { cwd: tmpPath });
79+
let nodeModules = path.join(tmpPath, 'node_modules');
80+
await fs.ensureDir(nodeModules);
81+
await fs.symlink(
82+
path.resolve(__dirname, '../..'),
83+
path.join(nodeModules, 'ember-cli-update')
84+
);
85+
await fs.symlink(
86+
path.resolve(path.dirname(require.resolve('ember-cli')), '../..'),
87+
path.join(nodeModules, 'ember-cli')
88+
);
7389

7490
await commit({
7591
m: 'my-app',
@@ -78,9 +94,11 @@ describe(function() {
7894
}
7995
});
8096

81-
// remove addon because it's not in the fixtures
8297
await mutatePackageJson(tmpPath, pkg => {
83-
delete pkg.devDependencies['ember-cli-update'];
98+
// The tradeoff of not npm installing is we don't get to
99+
// test real dep upgrades, which is acceptable for the
100+
// ember addon method.
101+
pkg.devDependencies = require('../fixtures/app/merge/my-app/package').devDependencies;
84102
});
85103

86104
fixtureCompare({

0 commit comments

Comments
 (0)