GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(test:endpoint): reduce number of eslint commands run · angular-fullstack/generator-angular-fullstack@6faa7f0

This repository was archived by the owner on Jul 29, 2026. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/test
    • endpoint.test.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/test/endpoint.test.js‎

Copy file name to clipboardExpand all lines: src/test/endpoint.test.js
+18-11Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,34 @@ function runEndpointGen(name, opt={}) {
6767
});
6868
}
6969

70-
let eslintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/eslint');
71-
function testFile(command, _path) {
72-
_path = path.normalize(_path);
73-
return fs.accessAsync(_path, fs.R_OK).then(() => {
74-
return runCmd(`${command} ${_path}`);
75-
});
70+
const ESLINT_CMD = path.join(TEST_DIR, '/fixtures/node_modules/.bin/eslint');
71+
72+
/**
73+
* @param {string[]} files
74+
* @param {string} [flags]
75+
*/
76+
function eslintFiles(files, flags = '') {
77+
return runCmd(`${ESLINT_CMD} ${flags} ${files.join(' ')}`);
7678
}
7779

7880
function eslintDir(dir, name, folder) {
7981
if(!folder) folder = name;
8082
let endpointDir = path.join(dir, 'server/api', folder);
83+
let files = fs.readdirAsync(endpointDir);
8184

82-
let regFiles = fs.readdirAsync(endpointDir)
85+
let regFiles = files
8386
.then(files => files.filter(file => minimatch(file, '**/!(*.spec|*.mock|*.integration).js', {dot: true})))
84-
.map(file => testFile(eslintCmd, path.join('./server/api/', folder, file)));
87+
.then(files => files.map(file => path.join('./server/api/', folder, file)));
8588

86-
let specFiles = fs.readdirAsync(endpointDir)
89+
let specFiles = files
8790
.then(files => files.filter(file => minimatch(file, '**/+(*.spec|*.mock|*.integration).js', {dot: true})))
88-
.map(file => testFile(`${eslintCmd} --env node,es6,mocha --global sinon,expect`, path.join('./server/api/', folder, file)));
91+
.then(files => files.map(file => path.join('./server/api/', folder, file)));
92+
93+
let regLint = regFiles.then(files => eslintFiles(files));
94+
95+
let specLint = specFiles.then(files => eslintFiles(files, '--env node,es6,mocha --global sinon,expect'));
8996

90-
return Promise.all([regFiles, specFiles]);
97+
return Promise.all([regLint, specLint]);
9198
}
9299

93100
var config;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.