From 0e690a326823cbbdd675cdb8f86a99dc3f206306 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 25 Jan 2017 00:55:02 -0500 Subject: [PATCH 1/5] ci(circle): refactor dep installs --- circle.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index ea698ae72..21bff1d87 100644 --- a/circle.yml +++ b/circle.yml @@ -25,11 +25,10 @@ dependencies: - "docs/node_modules" override: - npm i +# - gulp build # npm 5 won't run `prepublish` on `npm i`, we will need to re-enable this once we go to a Node version using npm 5+ - cd docs && npm i - gulp updateFixtures:test - - gulp installFixtures - post: - - gulp build + - cd test/fixtures && npm i && npm run-script update-webdriver test: override: From 6faa7f0a04bc434cfbf1912fa0ea843114880137 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 25 Jan 2017 00:57:21 -0500 Subject: [PATCH 2/5] perf(test:endpoint): reduce number of eslint commands run --- src/test/endpoint.test.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 5101bfd73..81878157f 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -67,27 +67,34 @@ function runEndpointGen(name, opt={}) { }); } -let eslintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/eslint'); -function testFile(command, _path) { - _path = path.normalize(_path); - return fs.accessAsync(_path, fs.R_OK).then(() => { - return runCmd(`${command} ${_path}`); - }); +const ESLINT_CMD = path.join(TEST_DIR, '/fixtures/node_modules/.bin/eslint'); + +/** + * @param {string[]} files + * @param {string} [flags] + */ +function eslintFiles(files, flags = '') { + return runCmd(`${ESLINT_CMD} ${flags} ${files.join(' ')}`); } function eslintDir(dir, name, folder) { if(!folder) folder = name; let endpointDir = path.join(dir, 'server/api', folder); + let files = fs.readdirAsync(endpointDir); - let regFiles = fs.readdirAsync(endpointDir) + let regFiles = files .then(files => files.filter(file => minimatch(file, '**/!(*.spec|*.mock|*.integration).js', {dot: true}))) - .map(file => testFile(eslintCmd, path.join('./server/api/', folder, file))); + .then(files => files.map(file => path.join('./server/api/', folder, file))); - let specFiles = fs.readdirAsync(endpointDir) + let specFiles = files .then(files => files.filter(file => minimatch(file, '**/+(*.spec|*.mock|*.integration).js', {dot: true}))) - .map(file => testFile(`${eslintCmd} --env node,es6,mocha --global sinon,expect`, path.join('./server/api/', folder, file))); + .then(files => files.map(file => path.join('./server/api/', folder, file))); + + let regLint = regFiles.then(files => eslintFiles(files)); + + let specLint = specFiles.then(files => eslintFiles(files, '--env node,es6,mocha --global sinon,expect')); - return Promise.all([regFiles, specFiles]); + return Promise.all([regLint, specLint]); } var config; From 95a5aab5ae811e8651659f161e2ba8c55a63c9a2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 25 Jan 2017 01:00:24 -0500 Subject: [PATCH 3/5] perf(test:endpoint): remove unused imports --- src/test/endpoint.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 81878157f..72a08135f 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -1,7 +1,6 @@ 'use strict'; import path from 'path'; import fs from 'fs'; -import _ from 'lodash'; import Promise from 'bluebird'; import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; @@ -10,7 +9,6 @@ import * as getExpectedFiles from './get-expected-files'; import { copyAsync, runCmd, - assertOnlyFiles, readJSON, runGen } from './test-helpers'; From 1f1a81ff6df5fae56907917cbdc966277c554f50 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 25 Jan 2017 01:00:52 -0500 Subject: [PATCH 4/5] refactor(test:endpoint): endpont -> endpoint --- src/test/endpoint.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 72a08135f..8a04165d8 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -114,7 +114,7 @@ describe('angular-fullstack:endpoint', function() { ]); }); - describe(`with a generated endpont 'foo'`, function() { + describe(`with a generated endpoint 'foo'`, function() { var dir; beforeEach(function() { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}).then(_dir => { @@ -136,7 +136,7 @@ describe('angular-fullstack:endpoint', function() { }); }); - describe('with a generated capitalized endpont', function() { + describe('with a generated capitalized endpoint', function() { var dir; beforeEach(function() { return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}).then(_dir => { @@ -158,7 +158,7 @@ describe('angular-fullstack:endpoint', function() { }); }); - describe('with a generated path name endpont', function() { + describe('with a generated path name endpoint', function() { var dir; beforeEach(function() { return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}).then(_dir => { From d42d0b67f042379bd57566d37647298fa36f272e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 25 Jan 2017 01:31:44 -0500 Subject: [PATCH 5/5] perf(test:main): reduce number of app generations --- src/test/main.test.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index e2668aa61..d1010caf5 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -58,7 +58,7 @@ describe('angular-fullstack:app', function() { describe('default settings', function() { var dir; - beforeEach(function() { + before(function() { return runGen(defaultOptions).then(_dir => { dir = _dir; }); @@ -83,7 +83,7 @@ describe('angular-fullstack:app', function() { }); describe('with a generated endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); @@ -95,9 +95,9 @@ describe('angular-fullstack:app', function() { }); describe('with a generated capitalized endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { - return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); + return runEndpointGen('Bar', {config: config['generator-angular-fullstack']}); }); }); @@ -107,9 +107,9 @@ describe('angular-fullstack:app', function() { }); describe('with a generated path name endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { - return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}); + return runEndpointGen('foo/baz', {config: config['generator-angular-fullstack']}); }); }); @@ -119,9 +119,9 @@ describe('angular-fullstack:app', function() { }); describe('with a generated snake-case endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { - return runEndpointGen('foo-bar', {config: config['generator-angular-fullstack']}); + return runEndpointGen('foo-boo', {config: config['generator-angular-fullstack']}); }); }); @@ -231,7 +231,7 @@ describe('angular-fullstack:app', function() { }); describe('with a generated endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); @@ -276,7 +276,7 @@ describe('angular-fullstack:app', function() { }; this.retries(3); // Sequelize seems to be quite flaky - beforeEach(function() { + before(function() { return runGen(testOptions).then(_dir => { dir = _dir; lintResult = runCmd('gulp lint:scripts'); @@ -303,7 +303,7 @@ describe('angular-fullstack:app', function() { }); describe.skip('with a generated endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); @@ -348,7 +348,7 @@ describe('angular-fullstack:app', function() { uibootstrap: false }; - beforeEach(function() { + before(function() { return runGen(testOptions, {options: {devPort: '9005'}}).then(_dir => { dir = _dir; lintResult = runCmd('gulp lint:scripts'); @@ -376,7 +376,7 @@ describe('angular-fullstack:app', function() { }); describe('with a generated endpoint', function() { - beforeEach(function() { + before(function() { return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); });