Skip to content

Commit 96650bf

Browse files
committed
test: add meaningful tests, coverage
1 parent aa75360 commit 96650bf

File tree

8 files changed

+1015
-403
lines changed

8 files changed

+1015
-403
lines changed

lib/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,27 @@ class WebpackPluginRamdisk {
2929
constructor(opts = {}) {
3030
const valid = validate(opts);
3131

32+
/* istanbul ignore if */
3233
if (valid.error) {
3334
error(chalk.red(`⬢ ${key}:`), `An option was passed to ${name} that is not valid`);
3435
throw valid.error;
3536
}
3637

3738
const options = Object.assign({}, defaults, opts);
39+
const diskPath = init(options);
40+
41+
this.diskPath = diskPath;
3842
this.options = options;
3943
}
4044

41-
async apply(compiler) {
42-
const diskPath = await init(this.options);
45+
apply(compiler) {
4346
const { output } = compiler.options;
44-
const outputPath = join(diskPath, output.path || 'dist');
45-
46-
this.options.diskPath = diskPath;
47+
const outputPath = join(this.diskPath, output.path || 'dist');
4748

4849
/* eslint-disable no-param-reassign */
4950
compiler.options.output = Object.assign({}, compiler.options.output, { path: outputPath });
5051
compiler.outputPath = compiler.options.output.path;
52+
this.outputPath = compiler.outputPath;
5153

5254
info(chalk.blue(`⬡ ${key}:`), `Build being written to ${outputPath}`);
5355
}

lib/ramdisk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const mount = (options) => {
4646
};
4747

4848
module.exports = {
49-
async init(opts) {
49+
init(opts) {
5050
const root = getRoot(opts.name);
5151
const blocks = opts.bytes / opts.blockSize;
5252
const options = Object.assign({}, opts, { blocks, root });

0 commit comments

Comments
 (0)