Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions change/change-7bd977ba-d97f-46df-be41-7378c5995273.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"changes": [
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "backfill-cache",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "backfill-hasher",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/cli",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/config",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/hasher",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/rpc",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/runners",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/scheduler",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/target-graph",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Address promise lint issues",
"packageName": "@lage-run/worker-threads-pool",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
}
]
}
3 changes: 1 addition & 2 deletions packages/backfill-cache/src/CacheStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ export abstract class CacheStorage implements ICacheStorage {
if (this.incrementalCaching) {
// Get the list of files that have not changed so we don't need to cache them.
const hashesNow = await getHashesFor(this.cwd);
const hashesThen =
(await savedHashes.get(hash)) || new Map<string, string>();
const hashesThen = savedHashes.get(hash) || new Map<string, string>();
const unchangedFiles = [...hashesThen.keys()].filter(
(s) => hashesThen.get(s) === hashesNow.get(s)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { CacheStorageConfig } from "backfill-config";

import { getCacheStorageProvider } from "../getCacheStorageProvider.js";

const setupCacheStorage = async (fixtureName: FixtureName) => {
const setupCacheStorage = (fixtureName: FixtureName) => {
const fixtureLocation = setupFixture(fixtureName);

const cacheStorageConfig: CacheStorageConfig = {
Expand Down Expand Up @@ -49,7 +49,7 @@ async function fetchFromCache({
expectSuccess = true,
}: CacheHelper) {
const { cacheStorage, internalCacheFolder, fixtureLocation } =
await setupCacheStorage(fixtureName);
setupCacheStorage(fixtureName);

const secretFile = "qwerty";

Expand All @@ -75,7 +75,7 @@ async function putInCache({
errorMessage,
}: CacheHelper) {
const { cacheStorage, internalCacheFolder, fixtureLocation } =
await setupCacheStorage(fixtureName);
setupCacheStorage(fixtureName);

if (!outputGlob) {
throw new Error("outputGlob should be provided to the putInCache function");
Expand Down
2 changes: 2 additions & 0 deletions packages/backfill-cache/src/__tests__/cacheStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class MockLocalCacheStorage extends CacheStorage {
super(logger, cwd, true);
}

// eslint-disable-next-line @typescript-eslint/require-await -- match signature
protected async _fetch(): Promise<boolean> {
return false;
}
// eslint-disable-next-line @typescript-eslint/require-await -- match signature
protected async _put(_hash: string, filesToCache: string[]): Promise<void> {
this.filesToCache = filesToCache;
}
Expand Down
16 changes: 8 additions & 8 deletions packages/backfill-config/src/__tests__/createConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("getName()", () => {
packageRoot = "";
});

it("get the name of the package", async () => {
it("get the name of the package", () => {
packageRoot = setupFixture("basic");
const packageName = getName(packageRoot);

Expand All @@ -33,7 +33,7 @@ describe("getSearchPaths()", () => {
packageRoot = "";
});

it("finds all instances of backfill.config.js", async () => {
it("finds all instances of backfill.config.js", () => {
packageRoot = setupFixture("config");

const pathPackage1 = path.join(packageRoot, "packages/package-1");
Expand All @@ -51,7 +51,7 @@ describe("getSearchPaths()", () => {
]);
});

it("returns empty list when no backfill.config.js can be found", async () => {
it("returns empty list when no backfill.config.js can be found", () => {
packageRoot = setupFixture("basic");
const searchPaths = getSearchPaths(packageRoot);

Expand All @@ -77,7 +77,7 @@ describe("createConfig()", () => {
process.env = originalEnv;
});

it("returns default config values when no config file and no env override is provided", async () => {
it("returns default config values when no config file and no env override is provided", () => {
packageRoot = setupFixture("basic");
const config = createConfig(logger, packageRoot);

Expand All @@ -86,7 +86,7 @@ describe("createConfig()", () => {
expect(config.internalCacheFolder).toStrictEqual(defaultLocalCacheFolder);
});

it("returns config file value when config file is provided, and no env override", async () => {
it("returns config file value when config file is provided, and no env override", () => {
packageRoot = setupFixture("config");
const config = createConfig(logger, packageRoot);

Expand All @@ -95,7 +95,7 @@ describe("createConfig()", () => {
expect(config.logLevel).toStrictEqual("info");
});

it("returns env override value when env override is provided", async () => {
it("returns env override value when env override is provided", () => {
process.env["BACKFILL_INTERNAL_CACHE_FOLDER"] = "bar";

packageRoot = setupFixture("config");
Expand All @@ -107,7 +107,7 @@ describe("createConfig()", () => {
});

// For some reason, "mode" is the only option that throws if invalid as of writing
it("throws on an invalid mode", async () => {
it("throws on an invalid mode", () => {
packageRoot = setupFixture("config");
fs.writeFileSync(
path.join(packageRoot, "backfill.config.js"),
Expand All @@ -118,7 +118,7 @@ describe("createConfig()", () => {
});

// This should be removed once more config validation is added in a major version
it("does not throw on other invalid options", async () => {
it("does not throw on other invalid options", () => {
packageRoot = setupFixture("config");
fs.writeFileSync(
path.join(packageRoot, "backfill.config.js"),
Expand Down
2 changes: 1 addition & 1 deletion packages/backfill-hasher/src/Hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class Hasher implements IHasher {
while (queue.length > 0) {
const nextPackageRoot = queue.shift()!;

const packageHash = await getPackageHash(
const packageHash = getPackageHash(
nextPackageRoot,
repoInfo,
this.logger
Expand Down
23 changes: 9 additions & 14 deletions packages/backfill-hasher/src/__tests__/Hasher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ describe("_addToQueue", () => {
};
};

it("adds internal dependencies to the queue", async () => {
it("adds internal dependencies to the queue", () => {
const { queueParams, packagePath } = initFixture();

_addToQueue(queueParams);

expect(queueParams.queue).toEqual([packagePath]);
});

it("doesn't add to the queue if the package has been evaluated", async () => {
it("doesn't add to the queue if the package has been evaluated", () => {
const { queueParams, packageToAdd } = initFixture();

// Override
Expand All @@ -71,7 +71,7 @@ describe("_addToQueue", () => {
expect(queueParams.queue).toEqual([]);
});

it("doesn't add to the queue if the package is already in the queue", async () => {
it("doesn't add to the queue if the package is already in the queue", () => {
const { queueParams, packagePath } = initFixture();

// Override
Expand All @@ -93,20 +93,15 @@ describe("Hasher", () => {
roots = [];
});

const setupFixtureAndReturnHash = async (
fixture: FixtureName = "monorepo"
) => {
const packageRoot = setupFixture(fixture);
roots.push(packageRoot);
async function setupFixtureAndReturnHash(fixture: FixtureName = "monorepo") {
const root = setupFixture(fixture);
roots.push(root);

const options = { packageRoot, outputGlob: ["lib/**"] };
const buildSignature = "yarn build";

const hasher = new Hasher(options, logger);
const hash = await hasher.createPackageHash(buildSignature);
const hasher = new Hasher({ packageRoot: root }, logger);
const hash = await hasher.createPackageHash("yarn build");

return hash;
};
}

it("creates different hashes given different fixtures", async () => {
const hash = await setupFixtureAndReturnHash();
Expand Down
18 changes: 9 additions & 9 deletions packages/backfill-hasher/src/__tests__/getFileHashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe(getFileHashes.name, () => {
root = "";
});

it("can parse committed file", async () => {
it("can parse committed file", () => {
root = setupFixture("hasher-test-project");

const results = getFileHashes(root);
Expand All @@ -101,7 +101,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle files in subfolders", async () => {
it("can handle files in subfolders", () => {
root = setupFixture("hasher-nested-test-project");

const results = getFileHashes(root);
Expand All @@ -112,7 +112,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle adding one file", async () => {
it("can handle adding one file", () => {
root = setupFixture("hasher-test-project");

const tempFilePath = path.join(root, "a.txt");
Expand All @@ -129,7 +129,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle adding two files", async () => {
it("can handle adding two files", () => {
root = setupFixture("hasher-test-project");

const tempFilePath1 = path.join(root, "a.txt");
Expand All @@ -149,7 +149,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle removing one file", async () => {
it("can handle removing one file", () => {
root = setupFixture("hasher-test-project");

const testFilePath = path.join(root, "file1.txt");
Expand All @@ -164,7 +164,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle changing one file", async () => {
it("can handle changing one file", () => {
root = setupFixture("hasher-test-project");

const testFilePath = path.join(root, "file1.txt");
Expand All @@ -180,7 +180,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle a filename with spaces", async () => {
it("can handle a filename with spaces", () => {
root = setupFixture("hasher-test-project");

const tempFilePath = path.join(root, "a file.txt");
Expand All @@ -197,7 +197,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle a filename with multiple spaces", async () => {
it("can handle a filename with multiple spaces", () => {
root = setupFixture("hasher-test-project");

const tempFilePath = path.join(root, "a file name.txt");
Expand All @@ -214,7 +214,7 @@ describe(getFileHashes.name, () => {
});
});

it("can handle a filename with non-standard characters", async () => {
it("can handle a filename with non-standard characters", () => {
root = setupFixture("hasher-test-project");

const tempFilePath = path.join(root, "newFile批把.txt");
Expand Down
Loading