Skip to content

Commit

Permalink
chore: add expresion to snapshot normaliser (#4976)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
eduardoboucas and kodiakhq[bot] authored Aug 19, 2022
1 parent 091387f commit a5bfa11
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
28 changes: 14 additions & 14 deletions tests/integration/snapshots/600.framework-detection.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -66,7 +66,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -114,7 +114,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -159,7 +159,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -206,7 +206,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -249,7 +249,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -283,7 +283,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -323,7 +323,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -374,7 +374,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -411,7 +411,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -450,7 +450,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -490,7 +490,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -529,7 +529,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down Expand Up @@ -572,7 +572,7 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
​␊
> Version␊
@netlify/build 27.14.0␊
@netlify/build 0.0.0␊
​␊
> Flags␊
offline: true␊
Expand Down
Binary file not shown.
9 changes: 5 additions & 4 deletions tests/integration/utils/snapshots.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const normalizers = [
const baseNormalizers = [
// Information about the package and the OS
{ pattern: /netlify-cli\/.+node-.+/g, value: 'netlify-cli/test-version test-os test-node-version' },
{ pattern: /@netlify\/build (\d+\.\d+\.\d+)/g, value: '@netlify/build 0.0.0' },
// normalize random ports
{ pattern: /\d{5}/g, value: '88888' },
// windows specific
Expand All @@ -23,13 +24,13 @@ const optionalNormalizers = {
}

const normalize = (inputString, { duration, filePath } = {}) => {
const allNormalizers = [
...normalizers,
const normalizers = [
...baseNormalizers,
duration && optionalNormalizers.duration,
filePath && optionalNormalizers.filePath,
]

return allNormalizers.filter(Boolean).reduce((acc, { pattern, value }) => acc.replace(pattern, value), inputString)
return normalizers.filter(Boolean).reduce((acc, { pattern, value }) => acc.replace(pattern, value), inputString)
}

module.exports = { normalize }

1 comment on commit a5bfa11

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 222 MB

Please sign in to comment.