Skip to content

Commit

Permalink
Merge pull request #6 from evelynhathaway/no-flatmap
Browse files Browse the repository at this point in the history
Remove flatmap
  • Loading branch information
crutchcorn authored May 13, 2020
2 parents b02d265 + 1e72c1f commit 47840b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
],
"ignorePatterns": [
"src/foo.js",
"lib/foo.js",
"notes.js",
"**/__fixtures__/**/output.js",
],
Expand Down
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ module.exports = {
testPathIgnorePatterns: [
"\\\\node_modules\\\\",
"\\\\__fixtures__\\\\",
"/__fixtures_/",
"__fixtures_",
"/node_modules/",
],

// The regexp pattern or array of patterns that Jest uses to detect test files
Expand Down Expand Up @@ -182,9 +185,7 @@ module.exports = {
// verbose: undefined,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
"watchPathIgnorePatterns": [
"__fixtures__\\/[^/]+\\/(output|error)\\.js",
],
watchPathIgnorePatterns: ["__fixtures__\\/[^/]+\\/(output|error)\\.js"],

// Whether to use watchman for file crawling
// watchman: true,
Expand Down
4 changes: 3 additions & 1 deletion plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ module.exports = () => {
const mockCodeArr = inBodyArgsToProxy.map(varNameToChange => getVariableMockCodeAST(varNameToChange));

// Flat map since the `codeAST` is itself an array
const codeASTToAppend = mockCodeArr.flatMap(val => val.codeAST);
const codeASTToAppend = mockCodeArr
.map((val) => val.codeAST)
.reduce((a, b) => a.concat(b), []);

blockStatementPath.node.body = [...codeASTToAppend, ...blockStatementPath.node.body];

Expand Down

0 comments on commit 47840b2

Please sign in to comment.