Skip to content

Commit

Permalink
feat: display default messages without dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mjeanroy committed Nov 23, 2016
1 parent 0d66d2e commit c84fc27
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/license-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class LicensePlugin {
.trim()
.value();

fs.writeFileSync(output, text);
fs.writeFileSync(output, text || 'No third parties dependencies');
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions test/license-plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,33 @@ describe('LicensePlugin', () => {
});
});

it('should display default message without dependencies', (done) => {
const file = path.join(tmpDir.name, 'third-party.txt');
const instance = new LicensePlugin({
thirdParty: {
output: file,
},
});

instance._dependencies = {};

const result = instance.ongenerate(false);

expect(result).not.toBeDefined();

fs.readFile(file, 'utf-8', (err, content) => {
if (err) {
done.fail(err);
return;
}

const txt = content.toString();
expect(txt).toBeDefined();
expect(txt).toEqual('No third parties dependencies');
done();
});
});

it('should not display private dependencies by default', (done) => {
const file = path.join(tmpDir.name, 'third-party.txt');
const instance = new LicensePlugin({
Expand Down

0 comments on commit c84fc27

Please sign in to comment.