Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Feb 15, 2019
1 parent 852a66a commit eead858
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 159 deletions.
31 changes: 31 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
},
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${relativeFile}", "--coverage", "false"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
]
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@hutson/set-npm-auth-token-for-ci": "^3.0.2",
"@octokit/plugin-enterprise-compatibility": "^1.0.0",
"@octokit/rest": "^16.13.1",
"arr-flatten": "^1.1.0",
"chalk": "^2.4.2",
"chrome-webstore-upload-cli": "^1.2.0",
"command-line-args": "^5.0.2",
Expand Down Expand Up @@ -112,6 +113,7 @@
]
},
"jest": {
"testEnvironment": "node",
"moduleFileExtensions": [
"ts",
"js"
Expand Down
45 changes: 24 additions & 21 deletions src/changelog.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import flatten from 'arr-flatten';
import { AsyncSeriesBailHook } from 'tapable';
import { URL } from 'url';
import join from 'url-join';
Expand Down Expand Up @@ -205,27 +206,29 @@ export default class Changelog {
);

await Promise.all(
commits.map(async commit => {
commit.authors.map(async author => {
if (author.username === 'invalid-email-address') {
return;
}

const user = await this.hooks.renderChangelogAuthor.promise(
author,
commit,
this.options
);
const authorEntry = await this.hooks.renderChangelogAuthorLine.promise(
author,
user as string
);

if (authorEntry && !authors.has(authorEntry)) {
authors.add(authorEntry);
}
});
})
flatten(
commits.map(commit =>
commit.authors.map(async author => {
if (author.username === 'invalid-email-address') {
return;
}

const user = await this.hooks.renderChangelogAuthor.promise(
author,
commit,
this.options
);
const authorEntry = await this.hooks.renderChangelogAuthorLine.promise(
author,
user as string
);

if (authorEntry && !authors.has(authorEntry)) {
authors.add(authorEntry);
}
})
)
)
);

if (authors.size === 0) {
Expand Down
4 changes: 4 additions & 0 deletions src/types/flatten.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module 'arr-flatten' {
function flatten<P>(arr: P[][]): P[];
export = flatten;
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"downlevelIteration": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"inlineSourceMap": true,
"declaration": true,
"lib": ["es6", "es2017", "es2017.object"],
Expand Down
Loading

0 comments on commit eead858

Please sign in to comment.