Skip to content

Commit

Permalink
chore(e2e): add e2e coverage for npmClientArgs on version
Browse files Browse the repository at this point in the history
  • Loading branch information
fahslaj committed Nov 18, 2022
1 parent 6d71848 commit 95dc451
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions e2e/tests/lerna-version/npm-client-args.spec.ts
@@ -0,0 +1,59 @@
import { Fixture } from "../../utils/fixture";
import { normalizeCommitSHAs, normalizeEnvironment } from "../../utils/snapshot-serializer-utils";

expect.addSnapshotSerializer({
serialize(str: string) {
return normalizeCommitSHAs(normalizeEnvironment(str));
},
test(val: string) {
return val != null && typeof val === "string";
},
});

describe("lerna-version-npm-client-args", () => {
let fixture: Fixture;

beforeEach(async () => {
fixture = await Fixture.create({
name: "lerna-version-npm-client-args",
packageManager: "npm",
initializeGit: true,
runLernaInit: true,
installDependencies: true,
});
await fixture.lerna("create package-a -y");

// eslint-plugin-react-app@6.2.2 requires a peer dependency of eslint@"6.x".
// Without it, the npm install at the end of `lerna version` will fail if
// --legacy-peer-deps is not passed correctly.
await fixture.updateJson("package.json", (json) => ({
...json,
dependencies: {
...(json.dependencies as Record<string, string>),
"eslint-plugin-react-app": "6.2.2",
eslint: "8.25.0",
},
}));
await fixture.createInitialGitCommit();
await fixture.exec("git push origin test-main");
});
afterEach(() => fixture.destroy());

it("should add npmClientArgs to npm install at the end of the version command", async () => {
const output = await fixture.lerna("version 3.3.3 -y --npmClientArgs=--legacy-peer-deps");
expect(output.combinedOutput).toMatchInlineSnapshot(`
lerna notice cli v999.9.9-e2e.0
lerna info current version 0.0.0
lerna info Assuming all packages changed
Changes:
- package-a: 0.0.0 => 3.3.3
lerna info auto-confirmed
lerna info execute Skipping releases
lerna info git Pushing tags...
lerna success version finished
`);
});
});

0 comments on commit 95dc451

Please sign in to comment.