Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forgot videojs-languages, add a test #170

Merged
merged 1 commit into from
Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generators/app/package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const packageJSON = (current, context) => {
// directory if needed.
if (context.lang) {
result.scripts['build:lang'] = 'vjslang --dir dist/lang';
result.devDependencies['videojs-languages'] = '^1.0.0';
_.assign(result.devDependencies, getGeneratorVersions(['videojs-languages']));
}

result.files.sort();
Expand Down
56 changes: 54 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
"videojs-standard": "^6.0.0"
},
"optionalDependencies": {
"global": "^4.3.2",
"video.js": "^5.19.2 || ^6.6.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"bannerize": "^1.1.3",
"global": "^4.3.2",
"in-publish": "^2.0.0",
"jsdoc": "^3.4.3",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-detect-browsers": "^2.2.6",
Expand All @@ -81,6 +81,7 @@
"semver": "^5.4.1",
"sinon": "^2.4.1",
"uglify-js": "^3.3.5",
"jsdoc": "^3.4.3"
"video.js": "^5.19.2 || ^6.6.0",
"videojs-languages": "^1.0.0"
}
}
50 changes: 50 additions & 0 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const helpers = require('yeoman-generator').test;
const libs = require('./libs');
const packageJSON = require('../generators/app/package-json');
const generatorVersion = require('../generators/app/generator-version');
const generatorPkg = require('../package.json');

describe('videojs-plugin:app', function() {
const scripts = [
Expand Down Expand Up @@ -106,6 +107,55 @@ describe('videojs-plugin:app', function() {
});
});

describe('all options', function() {

before(function(done) {
helpers.run(libs.GENERATOR_PATH)
.withOptions(libs.options())
.withPrompts({
name: 'wat',
author: 'John Doe',
description: 'wat is the plugin',
docs: true,
lang: true,
husky: 'test'
})
.on('end', () => libs.onEnd(this, done));
});

it('populates otherwise empty npm scripts', function() {
libs.allAreNonEmpty(this.pkg.scripts, scripts.concat([
'docs',
'docs:api',
'docs:toc',
'prepush',
'build:lang'
]));
});

it('does not have empty versions', function() {
libs.allAreNonEmpty(this.pkg.dependencies, Object.keys(this.pkg.dependencies));
libs.allAreNonEmpty(this.pkg.devDependencies, Object.keys(this.pkg.devDependencies));
});

it('(generator) has no extra optional deps', function() {
const optionalPackages = Object.keys(generatorPkg.optionalDependencies);
const packages = Object.keys(this.pkg.dependencies)
.concat(Object.keys(this.pkg.devDependencies));
let i = optionalPackages.length;

while (i--) {
const pkg = optionalPackages[i];

if (packages.indexOf(pkg) !== -1) {
optionalPackages.splice(i, 1);
}
}

assert.deepEqual(optionalPackages, [], 'there are no extra packages in optional dependencies');
});
});

describe('existing package.json with author object', function() {

before(function(done) {
Expand Down