function buildTest({
    file,
    input,
    expected,
    plugins = [],
    prepare = undefined,
    run = undefined
}) {
    /**
     * @param {import('ava').ExecutionContext} t
     */
    return async t => {
        const ctx = context(t);

        const { assert, mix, fs, webpack } = ctx;

        mix.setPublicPath('./');
        mix.options({ autoprefixer: {} });

        if (prepare) {
            const result = prepare(ctx);

            if (result instanceof Promise) {
                await result;
            }
        }

        const requires = plugins.map(plugin => `require('${plugin}')`).join(', ');

        await fs().stub({
            'postcss.config.cjs': `module.exports = { plugins: [ ${requires} ] };`,
            [`stubs/${file}`]: input
        });

        run = run || (({ mix }) => mix.postCss(`stubs/${file}`, 'css'));

        run(ctx);

        await webpack.compile();

        assert().file(`css/${file}`).exists();
        assert().file(`css/${file}`).matchesCss(expected);
    };
}
@param {object} param0
@param {string} param0.file
@param {string} param0.input
@param {string} param0.expected
@param {string[]} [param0.plugins]
@param {(ctx: TestContext) => unknown | Promise<unknown>} [param0.run]
@param {(ctx: TestContext) => unknown | Promise<unknown>} [param0.prepare]