Skip to content

Commit

Permalink
Improve type in e2e test script (#2155)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulkar committed Oct 14, 2022
1 parent 6194804 commit f3f18bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions cli/scripts/e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ const basicPipeline = {
// This is injected by github actions
process.env.TURBO_TOKEN = "";

let suites = [];
let suites: uvu.uvu.Test<uvu.Context>[] = [];
for (let npmClient of ["yarn", "berry", "pnpm6", "pnpm", "npm"] as const) {
const Suite = uvu.suite(`${npmClient}`);

const repo = new Monorepo("basics");
repo.init(npmClient, basicPipeline);
repo.install();
Expand All @@ -55,22 +56,25 @@ for (let npmClient of ["yarn", "berry", "pnpm6", "pnpm", "npm"] as const) {
repo.linkPackages();
repo.expectCleanGitStatus();
runSmokeTests(Suite, repo, npmClient);

const sub = new Monorepo("in-subdirectory");
sub.init(npmClient, basicPipeline, "js");
sub.install();
sub.addPackage("a", ["b"]);
sub.addPackage("b");
sub.addPackage("c");
sub.linkPackages();

runSmokeTests(Suite, sub, npmClient, {
cwd: path.join(sub.root, sub.subdir),
cwd: sub.subdir ? path.join(sub.root, sub.subdir) : sub.root,
});

suites.push(Suite);
// test that turbo can run from a subdirectory
}

for (let s of suites) {
s.run();
for (let suite of suites) {
suite.run();
}

type Task = {
Expand Down Expand Up @@ -620,7 +624,7 @@ function runSmokeTests<T>(
assert.fixture(pruneCommandOutput[1], " - Added a");
assert.fixture(pruneCommandOutput[2], " - Added b");

let files = [];
let files: string[] = [];
assert.not.throws(() => {
files = repo.globbySync("out/**/*", {
cwd: options.cwd ?? repo.root,
Expand Down
2 changes: 1 addition & 1 deletion cli/scripts/monorepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ importers:
});
}

addPackage(name, internalDeps = []) {
addPackage(name, internalDeps: string[] = []) {
return this.commitFiles({
[`packages/${name}/build.js`]: `
const fs = require('fs');
Expand Down

1 comment on commit f3f18bd

@vercel
Copy link

@vercel vercel bot commented on f3f18bd Oct 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.