Skip to content

feat(gen): also build test dir (just like generators dir) #1823

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

Merged
merged 53 commits into from
May 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e09fb76
feat(gen): also build test dir (just like generators dir)
Awk34 Apr 24, 2016
f852113
fix(gen:gulp:watch): use plumber when watching
Awk34 Apr 24, 2016
6398160
refactor(gen:test): promisify `fs`, use the promises
Awk34 Apr 24, 2016
8f5c120
fix(gen:test): fix copyAsync
Awk34 Apr 24, 2016
27806c5
refactor(gen:gulp): use lazypipe
Awk34 Apr 24, 2016
3748953
fix(gen:gulp:babel): return the two merged streams
Awk34 Apr 24, 2016
ead201a
feat(gen:gulp): add mocha
Awk34 Apr 24, 2016
316e93f
feat(gen:tests): step 1 of new test structure
Awk34 Apr 25, 2016
7c87953
chore(package): update test command to use `gulp test` instead of grunt
Awk34 Apr 25, 2016
04a7878
feat(gen:gulp): add installFixtures task
Awk34 Apr 25, 2016
62577ea
style(gen:gulp): use const for imports, add semicolon
Awk34 Apr 25, 2016
9b9c781
chore(package): add gulp-util
Awk34 Apr 25, 2016
5a21831
chore(package): add updateFixtures:deps & installFixtures to `test` s…
Awk34 Apr 25, 2016
5747739
fix(gen:gulp:watch): for some reason gulp-if isn't working inside laz…
Awk34 Apr 25, 2016
0787039
fix(gen:endpoint): typo
Awk34 Apr 25, 2016
d51295a
docs(gen:tests): add some JSDoc to `runCmd`
Awk34 Apr 25, 2016
36d79c2
feat(gen:tests): a bunch of test progress
Awk34 Apr 25, 2016
3310a1c
fix(gen:test): remove my `.only`
Awk34 Apr 25, 2016
1c91686
refactor(gen:test): move DEBUG var to mocha.conf.js
Awk34 Apr 27, 2016
fdd5b68
refactor(gen:test): pull 4 helper functions out into a separate module
Awk34 Apr 27, 2016
0b36375
feat(gen:test): add endpoint path name test
Awk34 Apr 27, 2016
babb03f
fix(gen:test): fix `getConfig` path
Awk34 Apr 27, 2016
2a1d702
refactor(gen:test): runCmd returns a Promise instead of taking a call…
Awk34 Apr 28, 2016
887476f
feat(gen:test): add endpoint-specific tests
Awk34 Apr 28, 2016
cfa3152
test(gen:main): remove pending endpoint lint tasks
Awk34 Apr 28, 2016
17d9985
fix(gen:test:endpoint): `jshint` function also checks that the file e…
Awk34 Apr 28, 2016
61eb160
refactor(test:endpoint): break out jshint suite into helper function
Awk34 Apr 28, 2016
20cfbe6
test(gen:endpoint): add other 2 lint tests, file assert stubs
Awk34 Apr 28, 2016
07d78eb
refactor(gen:test:endpoint): refactor `jshint` into more generic `tes…
Awk34 Apr 29, 2016
f145af2
test(gen:endpoint): jshint other 2 endpoints
Awk34 Apr 29, 2016
5389c14
test(gen:endpoint): add jscs endpoint tests
Awk34 Apr 29, 2016
93d7cb6
test(gen:endpont): use jscs programmatically
Awk34 Apr 30, 2016
c70d35a
test(gen): add pre-test (check fixtures)
Awk34 Apr 30, 2016
0445fcc
test(gen:main): test using existing config
Awk34 Apr 30, 2016
a1f2c6d
test(gen:pre): add .bowerrc & .yo-rc.json checks
Awk34 Apr 30, 2016
df20c8e
test(gen:main): various fixes/etc
Awk34 Apr 30, 2016
a24643a
test(gen:main): add 'with TypeScript, Jade, Jasmine, LESS, & OAuth' s…
Awk34 Apr 30, 2016
a75b1d4
fix(client:navbar.controller): refactor EJS, exclude constructor if e…
Awk34 May 1, 2016
4b4db99
fix(e2e:main): fix yeoman.png regex
Awk34 May 1, 2016
d21082d
style(grunt): less whitespace please
Awk34 May 1, 2016
9d5e945
test(gen:main): add snake-case endpoint test
Awk34 May 1, 2016
43ce8ee
test(gen:main): add e2e tests
Awk34 May 1, 2016
8827e93
test(gen:main): add the 2 other test suites (sql, no server)
Awk34 May 1, 2016
5aca55f
fix(e2e:prod): turn off lusca if using saucelabs
Awk34 May 1, 2016
53a24a3
test(gen:main): fix reg e2e tests running prod tests instead
Awk34 May 1, 2016
b41d4a6
test(gen:endpoint): add snake-case tests
Awk34 May 1, 2016
54d4ebd
fix(grunt): exclude jshint config if using TypeScript
Awk34 May 1, 2016
daf0540
perf(gen:test:main): lets get some concurrency/re-use going
Awk34 May 1, 2016
d64029f
refactor(gen:test): rm dead code, promisify fs in mocha.conf, del old…
Awk34 May 2, 2016
3febf4c
refactor(gen:test): move runGen to test-helpers, rename getConfig to …
Awk34 May 2, 2016
97ddb8b
chore(package): bump yeoman-test to ^1.3.0
Awk34 May 2, 2016
ae514e1
test(gen): slow tests are 500ms and above
Awk34 May 2, 2016
3b613e7
test(gen:main): retry e2e tests twice
Awk34 May 2, 2016
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
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
node_modules
bower_components
test/temp
/generators/*
/test/*
demo
.idea
.DS_Store
release.txt
test/fixtures/bower.json
test/fixtures/package.json
generators
release.txt
107 changes: 97 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,70 @@
'use strict';
var fs = require('fs');
var path = require('path');
var Promise = require('bluebird');
var gulp = require('gulp');
var babel = require('gulp-babel');
var del = require('del');
var runSequence = require('run-sequence');
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
const _ = require('lodash');
const Promise = require('bluebird');
const gulp = require('gulp');
const gutil = require('gulp-util');
const babel = require('gulp-babel');
const gulpMocha = require('gulp-mocha');
const plumber = require('gulp-plumber');
const gulpIf = require('gulp-if');
const del = require('del');
const lazypipe = require('lazypipe');
const runSequence = require('run-sequence');
const merge = require('merge-stream');
const shell = require('shelljs');

var watching = false;

const mocha = lazypipe()
.pipe(gulpMocha, {
reporter: 'spec',
timeout: 120000,
slow: 500,
globals: {
should: require('should')
},
require: [
'./mocha.conf'
]
});

const transpile = lazypipe()
.pipe(babel);

gulp.task('clean', () => {
return del(['generators/**/*']);
});

gulp.task('babel', () => {
return gulp.src(['src/**/*.js'])
.pipe(babel())
let generators = gulp.src(['src/generators/**/*.js'])
.pipe(gulpIf(watching, plumber()))
.pipe(transpile())
.pipe(gulp.dest('generators'));

let test = gulp.src(['src/test/**/*.js'])
.pipe(gulpIf(watching, plumber()))
.pipe(transpile())
.pipe(gulp.dest('test'));

return merge(generators, test);
});

gulp.task('watch', () => {
watching = true;
return gulp.watch('src/**/*.js', ['babel']);
});

gulp.task('copy', () => {
return gulp.src(['src/**/*', '!src/**/*.js'])
let nonJsGen = gulp.src(['src/generators/**/*', '!src/generators/**/*.js'], {dot: true})
.pipe(gulp.dest('generators'));

let nonJsTest = gulp.src(['src/test/**/*', '!src/test/**/*.js'], {dot: true})
.pipe(gulp.dest('test'));

return merge(nonJsGen, nonJsTest);
});

gulp.task('build', cb => {
Expand Down Expand Up @@ -81,3 +122,49 @@ gulp.task('updateFixtures:test', () => {
gulp.task('updateFixtures:deps', () => {
return updateFixtures('deps');
});

function execAsync(cmd, opt) {
return new Promise((resolve, reject) => {
exec(cmd, opt, (err, stdout, stderr) => {
if(err) {
console.log(`stderr: ${stderr}`);
return reject(err);
}

return resolve(stdout);
})
});
}

gulp.task('installFixtures', function() {
gutil.log('installing npm & bower dependencies for generated app');
let progress = setInterval(() => {
process.stdout.write('.');
}, 1 * 1000);
shell.cd('test/fixtures');

return Promise.all([
execAsync('npm install --quiet', {cwd: '../fixtures'}),
execAsync('bower install', {cwd: '../fixtures'})
]).then(() => {
process.stdout.write('\n');
if(!process.env.SAUCE_USERNAME) {
gutil.log('running npm run-script update-webdriver');
return execAsync('npm run-script update-webdriver').then(() => {
clearInterval(progress);
process.stdout.write('\n');
shell.cd('../../');
});
} else {
clearInterval(progress);
process.stdout.write('\n');
shell.cd('../../');
return Promise.resolve();
}
});
});

gulp.task('test', () => {
return gulp.src(['test/pre.test.js', 'test/*.test.js'])
.pipe(mocha());
});
7 changes: 7 additions & 0 deletions mocha.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

global.DEBUG = !!process.env.DEBUG;

var fs = require('fs');
var Promise = require('bluebird');
Promise.promisifyAll(fs);
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "git://github.com/angular-fullstack/generator-angular-fullstack.git"
},
"scripts": {
"test": "gulp build && grunt test",
"test": "gulp updateFixtures:test && gulp installFixtures && gulp build && gulp test",
"prepublish": "gulp build"
},
"dependencies": {
Expand Down Expand Up @@ -67,14 +67,23 @@
"grunt-mocha-test": "^0.12.7",
"grunt-release": "^0.13.0",
"gulp": "^3.9.1",
"gulp-if": "^2.0.0",
"gulp-mocha": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-util": "^3.0.7",
"jit-grunt": "~0.10.0",
"jscs": "^3.0.3",
"lazypipe": "^1.0.1",
"merge-stream": "^1.0.0",
"minimatch": "^3.0.0",
"mocha": "^2.2.5",
"q": "^1.0.1",
"recursive-readdir": "^2.0.0",
"run-sequence": "^1.1.5",
"shelljs": "^0.6.0",
"should": "^8.3.1",
"yeoman-assert": "^2.0.0",
"yeoman-test": "^1.1.0"
"yeoman-test": "^1.3.0"
},
"engines": {
"node": "^5.10.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/endpoint/index.js → src/generators/endpoint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Generator extends Base {
});

this.option('endpointDirectory', {
desc: 'Parent directory for enpoints',
desc: 'Parent directory for endpoints',
type: String
});
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading