Skip to content

Commit

Permalink
Update to yeoman-generator 2.0 + latest generator scaffolding (pretti…
Browse files Browse the repository at this point in the history
…er & cie)
  • Loading branch information
SBoudrias committed Oct 22, 2017
1 parent ca1494b commit 61bee83
Show file tree
Hide file tree
Showing 9 changed files with 5,485 additions and 164 deletions.
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
coverage/
node_modules
coverage
43 changes: 25 additions & 18 deletions __tests__/test-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@ var path = require('path');
var assert = require('yeoman-assert');
var helpers = require('yeoman-test');

describe('license:app', function () {
it('does not create new package.json', function () {
return helpers.run(require.resolve('../app'))
describe('license:app', function() {
it('does not create new package.json', function() {
return helpers
.run(require.resolve('../app'))
.withPrompts({
name: 'Rick',
email: '[email protected]',
website: 'http://example.com',
license: 'MIT'
}).then(function () {
})
.then(function() {
assert.file('LICENSE');
assert.noFile('package.json');
});
});

it('edit pre-existing package.json', function () {
return helpers.run(require.resolve('../app'))
.inTmpDir(function (dir) {
it('edit pre-existing package.json', function() {
return helpers
.run(require.resolve('../app'))
.inTmpDir(function(dir) {
var done = this.async();
var fs = require('fs');
fs.writeFile(path.join(dir, 'package.json'), '{}', done);
Expand All @@ -30,31 +33,34 @@ describe('license:app', function () {
website: 'http://example.com',
license: 'MIT'
})
.then(function () {
.then(function() {
assert.file('LICENSE');
assert.fileContent('package.json', '"license": "MIT"');
});
});

it('with author options: --name --email --website', function () {
return helpers.run(require.resolve('../app'))
it('with author options: --name --email --website', function() {
return helpers
.run(require.resolve('../app'))
.withPrompts({
license: 'ISC'
})
.withOptions({
name: 'Rick',
email: '[email protected]',
website: 'http://example.com'
}).then(function () {
})
.then(function() {
assert.fileContent('LICENSE', 'ISC');
assert.fileContent('LICENSE', 'Rick <[email protected]> (http://example.com)');
assert.noFile('package.json');
});
});

it('makes npm module private when license selected is nolicense', function () {
return helpers.run(require.resolve('../app'))
.inTmpDir(function (dir) {
it('makes npm module private when license selected is nolicense', function() {
return helpers
.run(require.resolve('../app'))
.inTmpDir(function(dir) {
var fs = require('fs');
fs.writeFileSync(path.join(dir, 'package.json'), '{}');
})
Expand All @@ -65,14 +71,15 @@ describe('license:app', function () {
licensePrompt: 'Choose a license',
license: 'nolicense'
})
.then(function () {
.then(function() {
assert.noFileContent('package.json', '"license"');
assert.fileContent('package.json', '"private": true');
});
});

it('--output change the destination directory', function () {
return helpers.run(path.join(__dirname, '../app'))
it('--output change the destination directory', function() {
return helpers
.run(path.join(__dirname, '../app'))
.withOptions({
output: 'src/license.txt'
})
Expand All @@ -83,7 +90,7 @@ describe('license:app', function () {
website: 'http://example.com',
license: 'GPL-3.0'
})
.then(function () {
.then(function() {
assert.file('src/license.txt');
assert.noFile('LICENSE');
});
Expand Down
Loading

0 comments on commit 61bee83

Please sign in to comment.