Repository: netlify/build
Pull request #424 (2019-11-04 12:47:58)

Fix failing test with new nyc release
This fixes some tests failing due to a new nyc release.


Patch:
diff --git a/packages/build/src/log/stack.js b/packages/build/src/log/stack.js
index 7063933be..2220ab2b1 100644
--- a/packages/build/src/log/stack.js
+++ b/packages/build/src/log/stack.js
@@ -46,7 +46,12 @@ const cleanStackLine = function(lines, line) {
 const STACK_LINE_REGEXP = /^\s+at /
 
 const isUselessStack = function(line) {
-  return line.includes('<anonymous>')
+  return (
+    // Anonymous function
+    line.includes('<anonymous>') ||
+    // nyc internal code
+    line.includes('node_modules/append-transform')
+  )
 }
 
 const isInternalStack = function(line) {


Test patch:
diff --git a/packages/build/tests/snapshots/functions.js.md b/packages/build/tests/snapshots/functions.js.md
index 1663d6eaa..57fa44bd3 100644
--- a/packages/build/tests/snapshots/functions.js.md
+++ b/packages/build/tests/snapshots/functions.js.md
@@ -4,7 +4,7 @@ The actual snapshot is saved in `functions.js.snap`.
 
 Generated by [AVA](https://ava.li).
 
-## Functions: ignore package.json inside node_modules
+## Functions: default directory
 
 > Snapshot 1
 
@@ -56,7 +56,7 @@ Generated by [AVA](https://ava.li).
     (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧ Have a nice day!␊
     `
 
-## Functions: install dependencies nested
+## Functions: ignore package.json inside node_modules
 
 > Snapshot 1
 
@@ -87,8 +87,6 @@ Generated by [AVA](https://ava.li).
     │ 2. Running install lifecycle from @netlify/plugin-functions-core   │␊
     └────────────────────────────────────────────────────────────────────┘␊
     ␊
-    Installing functions dependencies␊
-    added packages␊
     ␊
      √  @netlify/plugin-functions-core.install completed in 1ms␊
     ␊
@@ -97,7 +95,9 @@ Generated by [AVA](https://ava.li).
     └───────────────────────────────────────────────────────────────────────────┘␊
     ␊
     Zipping functions␊
-    Functions bundled in "/file/path": √  @netlify/plugin-functions-core.functionsBuild completed in 1ms␊
+    Functions bundled in "/file/path": - test.zip␊
+    ␊
+     √  @netlify/plugin-functions-core.functionsBuild completed in 1ms␊
     ␊
     ┌─────────────────────────────┐␊
     │   Netlify Build Complete!   │␊
@@ -108,7 +108,7 @@ Generated by [AVA](https://ava.li).
     (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧ Have a nice day!␊
     `
 
-## Functions: install dependencies top-level
+## Functions: install dependencies nested
 
 > Snapshot 1
 
@@ -149,9 +149,7 @@ Generated by [AVA](https://ava.li).
     └───────────────────────────────────────────────────────────────────────────┘␊
     ␊
     Zipping functions␊
-    Functions bundled in "/file/path": - test.zip␊
-    ␊
-     √  @netlify/plugin-functions-core.functionsBuild completed in 1ms␊
+    Functions bundled in "/file/path": √  @netlify/plugin-functions-core.functionsBuild completed in 1ms␊
     ␊
     ┌─────────────────────────────┐␊
     │   Netlify Build Complete!   │␊
@@ -162,7 +160,7 @@ Generated by [AVA](https://ava.li).
     (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧ Have a nice day!␊
     `
 
-## Functions: invalid source directory
+## Functions: install dependencies top-level
 
 > Snapshot 1
 
@@ -186,16 +184,37 @@ Generated by [AVA](https://ava.li).
     │ 1. Running init lifecycle from @netlify/plugin-functions-core   │␊
     └─────────────────────────────────────────────────────────────────┘␊
     ␊
+    ␊
+     √  @netlify/plugin-functions-core.init completed in 1ms␊
+    ␊
+    ┌────────────────────────────────────────────────────────────────────┐␊
+    │ 2. Running install lifecycle from @netlify/plugin-functions-core   │␊
+    └────────────────────────────────────────────────────────────────────┘␊
+    ␊
+    Installing functions dependencies␊
+    added packages␊
+    ␊
+     √  @netlify/plugin-functions-core.install completed in 1ms␊
+    ␊
+    ┌───────────────────────────────────────────────────────────────────────────┐␊
+    │ 3. Running functionsBuild lifecycle from @netlify/plugin-functions-core   │␊
+    └───────────────────────────────────────────────────────────────────────────┘␊
+    ␊
+    Zipping functions␊
+    Functions bundled in "/file/path": - test.zip␊
+    ␊
+     √  @netlify/plugin-functions-core.functionsBuild completed in 1ms␊
     ␊
     ┌─────────────────────────────┐␊
-    │    Netlify Build Error!     │␊
+    │   Netlify Build Complete!   │␊
     └─────────────────────────────┘␊
     ␊
-    In "init" step from "@netlify/plugin-functions-core":␊
-    Error: Functions directory "/file/path" not found␊
+     √  Netlify Build completed in 1ms␊
+    ␊
+    (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧ Have a nice day!␊
     `
 
-## Functions: simple setup
+## Functions: invalid source directory
 
 > Snapshot 1
 
@@ -219,35 +238,16 @@ Generated by [AVA](https://ava.li).
     │ 1. Running init lifecycle from @netlify/plugin-functions-core   │␊
     └─────────────────────────────────────────────────────────────────┘␊
     ␊
-    ␊
-     √  @netlify/plugin-functions-core.init completed in 1ms␊
-    ␊
-    ┌────────────────────────────────────────────────────────────────────┐␊
-    │ 2. Running install lifecycle from @netlify/plugin-functions-core   │␊
-    └────────────────────────────────────────────────────────────────────┘␊
-    ␊
-    ␊
-     √  @netlify/plugin-functions-core.install completed in 1ms␊
-    ␊
-    ┌───────────────────────────────────────────────────────────────────────────┐␊
-    │ 3. Running functionsBuild lifecycle from @netlify/plugin-functions-core   │␊
-    └───────────────────────────────────────────────────────────────────────────┘␊
-    ␊
-    Zipping functions␊
-    Functions bundled in "/file/path": - test.zip␊
-    ␊
-     √  @netlify/plugin-functions-core.functionsBuild completed in 1ms␊
     ␊
     ┌─────────────────────────────┐␊
-    │   Netlify Build Complete!   │␊
+    │    Netlify Build Error!     │␊
     └─────────────────────────────┘␊
     ␊
-     √  Netlify Build completed in 1ms␊
-    ␊
-    (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧ Have a nice day!␊
+    In "init" step from "@netlify/plugin-functions-core":␊
+    Error: Functions directory "/file/path" not found␊
     `
 
-## Functions: default directory
+## Functions: simple setup
 
 > Snapshot 1