import PurgeCSS from "../src/index";

describe("performance", () => {
  it("should not suffer from tons of content and css", function () {
    // TODO Remove this excessive timeout once performance is better.
    jest.setTimeout(60000);
    const start = Date.now();
    return new PurgeCSS()
      .purge({
        // Use all of the .js files in node_modules to purge all of the .css
        // files in __tests__/test_examples, including tailwind.css, which is
        // a whopping 908KB of CSS before purging.
        content: ["./packages/purgecss/node_modules/**/*.js"],
        css: [
          "./packages/purgecss/__tests__/test_examples/*/*.css",
          "./packages/purgecss/node_modules/tailwindcss/dist/tailwind.css",
        ],
      })
      .then((results) => {
        expect(results.length).toBeGreaterThanOrEqual(1);
        expect(
          results.some((result) => {
            return result.file && result.file.endsWith("/tailwind.css");
          })
        ).toBe(true);
        results.forEach((result) => expect(typeof result.css).toBe("string"));
        console.log("performance test took", Date.now() - start, "ms");
      });
  });
});

import PurgeCSS from "../src/index";

describe("performance", () => {
  it("should not suffer from tons of content and css", function () {
    const start = Date.now();
    return new PurgeCSS()
      .purge({
        // Use all of the .js files in node_modules to purge all of the .css
        // files in __tests__/test_examples, including tailwind.css, which is
        // a whopping 908KB of CSS before purging.
        content: ["./packages/purgecss/node_modules/**/*.js"],
        css: [
          "./packages/purgecss/__tests__/test_examples/*/*.css",
          "./packages/purgecss/node_modules/tailwindcss/dist/tailwind.css",
        ],
      })
      .then((results) => {
        expect(results.length).toBeGreaterThanOrEqual(1);
        expect(
          results.some((result) => {
            return result.file && result.file.endsWith("/tailwind.css");
          })
        ).toBe(true);
        results.forEach((result) => expect(typeof result.css).toBe("string"));
        console.log("performance test took", Date.now() - start, "ms");
      });
  });
});

Remove excessive jest.setTimeout(60000) now that perf is better.
perf: Remove excessive jest.setTimeout(60000) now that perf is better.
