Skip to content

Commit

Permalink
fix(test): webpack test type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ffloriel committed Jan 10, 2021
1 parent 24116f3 commit c41ad27
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/purgecss-webpack-plugin/__tests__/index.test.ts
@@ -1,16 +1,18 @@
import * as path from "path";
import fs from "fs";
import { promisify } from "util";
import webpack, { Configuration, Stats } from "webpack";
import webpack, { Configuration } from "webpack";

const asyncFs = {
readdir: promisify(fs.readdir),
};

function runWebpack(options: Configuration): Promise<webpack.Stats> {
function runWebpack(
options: Configuration
): Promise<webpack.Stats | undefined> {
const compiler = webpack(options);
return new Promise<webpack.Stats>((resolve, reject) => {
compiler.run((err?: Error, stats?: Stats) => {
return new Promise((resolve, reject) => {
compiler.run((err, stats) => {
if (err) reject(err);
if (stats?.hasErrors()) reject(new Error(stats.toString()));
resolve(stats);
Expand Down

0 comments on commit c41ad27

Please sign in to comment.