Skip to content

Commit

Permalink
Update quip-cli package
Browse files Browse the repository at this point in the history
- Make `readFile` synchronous since this part seems to be flaky when running tests
- Update CSS plugin variable name to match new dependency name
  • Loading branch information
kvnlam committed May 3, 2024
1 parent 627215c commit 8f74cf1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions packages/quip-cli/test/migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ describe("qla migration", () => {
afterAll(() => cleanup());

test("verify manifest", async () => {
const manifest = await readManifest();
const manifest = readManifest();
// We run this first to force snapshots to be updated when fixtures change.
expect(manifest).toMatchSnapshot();
});
oclifTest
.command(["migration"])
.it("creates a migration with today's date", async (ctx) => {
const manifest = await readManifest();
const manifest = readManifest();
expect(manifest.migrations).toBeDefined();
expect(manifest.migrations[0]).toMatchSnapshot();
const migration = await fs.promises.readFile(
Expand All @@ -53,7 +53,7 @@ describe("qla migration", () => {
.it(
"increments the migration number when adding another",
async (ctx) => {
const manifest = await readManifest();
const manifest = readManifest();
expect(manifest.migrations).toMatchSnapshot();
}
);
Expand All @@ -67,7 +67,7 @@ describe("qla migration", () => {
afterAll(() => cleanup());

test("verify manifest", async () => {
const manifest = await readManifest();
const manifest = readManifest();
// We run this first to force snapshots to be updated when fixtures change.
expect(manifest).toMatchSnapshot();
});
Expand All @@ -76,7 +76,7 @@ describe("qla migration", () => {
.it(
"creates a migration with a filesystem friendly name",
async (ctx) => {
const manifest = await readManifest();
const manifest = readManifest();
expect(manifest.migrations[0]).toMatchSnapshot();
}
);
Expand All @@ -85,7 +85,7 @@ describe("qla migration", () => {
.it(
"increments the migration number when adding another",
async (ctx) => {
const manifest = await readManifest();
const manifest = readManifest();
expect(manifest.migrations[1]).toMatchSnapshot();
}
);
Expand All @@ -99,14 +99,14 @@ describe("qla migration", () => {
afterAll(() => cleanup());

test("verify manifest", async () => {
const manifest = await readManifest();
const manifest = readManifest();
// We run this first to force snapshots to be updated when fixtures change.
expect(manifest).toMatchSnapshot();
});
oclifTest
.command(["migration", "version", "-v=42"])
.it("adds the correct version_number", async (ctx) => {
const manifest = await readManifest();
const manifest = readManifest();
expect(manifest.migrations[0]).toMatchSnapshot();
});
});
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("qla migration", () => {
.it(
"creates a new folder and adds a migration to the specified folder",
async (ctx) => {
const manifest = await readManifest();
const manifest = readManifest();
expect(manifest.migrations[0]).toMatchSnapshot();
expect(() =>
fs.statSync(
Expand Down
8 changes: 4 additions & 4 deletions packages/quip-cli/test/test-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const useFixtureDir = (dir: string) => {
return cleanFixtures(true);
};
};
export const readManifestContent = async (dir?: string): Promise<string> => {
export const readManifestContent = (dir?: string): string => {
const mPath = dir ? path.join(dir, "manifest.json") : "manifest.json";
return String(await fs.promises.readFile(mPath, "utf-8"));
return String(fs.readFileSync(mPath, "utf-8"));
};
export const readManifest = async (dir?: string) => {
const content = await readManifestContent(dir);
export const readManifest = (dir?: string) => {
const content = readManifestContent(dir);
return JSON.parse(content);
};
4 changes: 2 additions & 2 deletions packages/webpack-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const fs = require("fs");
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("css-minimizer-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const WriteFilePlugin = require("write-file-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const Autoprefixer = require("autoprefixer");
Expand All @@ -30,7 +30,7 @@ function minimizers() {
mangle: false,
},
}),
new OptimizeCSSAssetsPlugin({}),
new CssMinimizerPlugin({}),
];
}
return minimizers;
Expand Down

0 comments on commit 8f74cf1

Please sign in to comment.