Skip to content

Commit

Permalink
fixed #86 and lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bestander committed Jul 4, 2016
1 parent a213995 commit fd30c0b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ watch:
./node_modules/.bin/gulp watch

test-only:
./node_modules/.bin/nyc --check-coverage --lines 85 --branches 74 --functions 85 ./node_modules/.bin/ava --verbose test/
./node_modules/.bin/nyc --check-coverage --lines 85 --branches 74 --functions 85 ./node_modules/.bin/ava --verbose --concurrency 5 test/
./node_modules/.bin/nyc report --reporter=lcov

lint:
Expand Down
13 changes: 0 additions & 13 deletions src/cli/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import type { RegistryNames } from "../../registries/index.js";
import type { Reporter } from "kreporters";
import type Config from "../../config.js";
import type { DependencyRequestPatterns } from "../../types.js";
import Lockfile from "../../lockfile/index.js";
import lockStringify from "../../lockfile/stringify.js";
import PackageInstallScripts from "../../package-install-scripts.js";
Expand All @@ -31,18 +30,6 @@ let invariant = require("invariant");
let emoji = require("node-emoji");
let path = require("path");

type FetchResolveParams = {
totalSteps: number,
patterns: Array<string>,
requests: DependencyRequestPatterns
};

type FetchResolveReturn = {
patterns: Array<string>,
total: number,
step: number
};

type InstallActions = "install" | "update" | "uninstall";

export class Install {
Expand Down
4 changes: 4 additions & 0 deletions src/package-linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ export default class PackageLinker {

async copyModules(patterns: Array<string>): Promise<void> {
let flatTree = await this.initCopyModules(patterns);
// sorted tree makes file creation and copying not to interfere with each other
flatTree = flatTree.sort((dep1, dep2) => {
return dep1[0].localeCompare(dep2[0]);
});
let self = this;

//
Expand Down
10 changes: 6 additions & 4 deletions test/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ async function run(flags, args, name, checkInstalled, beforeInstall) {
}

async function getPackageVersion(config, packagePath) {
return JSON.parse(await fs.readFile(path.join(config.cwd, `node_modules/${packagePath}/package.json`))).version;
return JSON.parse(await fs.readFile(
path.join(config.cwd, `node_modules/${packagePath}/package.json`))).version;
}

test("root install from shrinkwrap", () => {
Expand Down Expand Up @@ -653,7 +654,7 @@ test.skip("install --save should add missing deps to fbkpm and mirror (PR import
let cwd = path.join(fixturesLoc, fixture);
await fs.copy(path.join(cwd, "fbkpm.lock.before"), path.join(cwd, "fbkpm.lock"));

return run({save: true}, [], fixture, async (config, reporter) => {
return run({save: true}, [], fixture, async (config) => {
assert.equal(await getPackageVersion(config, "mime-types"), "2.0.0");
assert(semver.satisfies(await getPackageVersion(config, "mime-db"), "~1.0.1"));
assert.equal(await getPackageVersion(config, "fake-fbkpm-dependency"), "1.0.1");
Expand All @@ -678,7 +679,8 @@ test.skip("install --save should add missing deps to fbkpm and mirror (PR import
});

// TODO https://github.com/facebook/fbkpm/issues/78
test.skip("install --save should update a dependency to fbkpm and mirror (PR import scenario 2)", async () => {
test.skip("install --save should update a dependency to fbkpm and mirror (PR import scenario 2)",
async () => {
// mime-types@2.0.0 is saved in local mirror and gets updated to mime-types@2.1.11 via
// a change in package.json,
// files in mirror, fbkpm.lock, package.json and node_modules should reflect that
Expand Down Expand Up @@ -741,7 +743,7 @@ test("install --initMirror should add init mirror deps from package.json", async
let fixture = "install-init-mirror";

// initMirror gets converted to save flag in cli/install.js
return run({save: true}, [], fixture, async (config, reporter) => {
return run({save: true}, [], fixture, async (config) => {
assert.equal(await getPackageVersion(config, "mime-types"), "2.0.0");
assert(semver.satisfies(await getPackageVersion(config, "mime-db"), "~1.0.1"));

Expand Down

0 comments on commit fd30c0b

Please sign in to comment.