Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide systemLogFile flag from output #4427

Merged
merged 3 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/build/src/log/messages/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const INTERNAL_FLAGS = [
'mode',
'apiHost',
'cacheDir',
'systemLogFile',
]
const HIDDEN_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, ...INTERNAL_FLAGS]
const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS]
Expand Down
91 changes: 91 additions & 0 deletions packages/build/tests/edge_functions/snapshots/tests.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,3 +596,94 @@ Generated by [AVA](https://avajs.dev).
────────────────────────────────────────────────────────────────␊
(Netlify Build completed in 1ms)`

## writes manifest contents to stdout if `debug` is set

> Snapshot 1

`␊
────────────────────────────────────────────────────────────────␊
Netlify Build ␊
────────────────────────────────────────────────────────────────␊
> Version␊
@netlify/build 1.0.0␊
> Flags␊
debug: true␊
mode: buildbot␊
repositoryRoot: packages/build/tests/edge_functions/fixtures/functions_user␊
systemLogFile: 7␊
testOpts:␊
pluginsListUrl: test␊
silentLingeringProcesses: true␊
> Current directory␊
packages/build/tests/edge_functions/fixtures/functions_user␊
> Config file␊
packages/build/tests/edge_functions/fixtures/functions_user/netlify.toml␊
> Resolved config␊
build:␊
edge_functions: packages/build/tests/edge_functions/fixtures/functions_user/netlify/edge-functions␊
publish: packages/build/tests/edge_functions/fixtures/functions_user␊
publishOrigin: default␊
> Context␊
production␊
────────────────────────────────────────────────────────────────␊
1. Edge Functions bundling ␊
────────────────────────────────────────────────────────────────␊
Packaging Edge Functions from netlify/edge-functions directory:␊
- function-1␊
Edge Functions manifest: {"bundles":[{"asset":"HEXADECIMAL_ID.js","format":"js"}],"routes":[{"function":"function-1","pattern":"^/one/?$"}],"bundler_version":"1.0.0"}␊
(Edge Functions bundling completed in 1ms)␊
────────────────────────────────────────────────────────────────␊
Netlify Build Complete ␊
────────────────────────────────────────────────────────────────␊
(Netlify Build completed in 1ms)`

## writes manifest contents to system logs if `systemLogFile` is set

> Snapshot 1

`␊
────────────────────────────────────────────────────────────────␊
Netlify Build ␊
────────────────────────────────────────────────────────────────␊
> Version␊
@netlify/build 1.0.0␊
> Flags␊
debug: false␊
> Current directory␊
packages/build/tests/edge_functions/fixtures/functions_user␊
> Config file␊
packages/build/tests/edge_functions/fixtures/functions_user/netlify.toml␊
> Context␊
production␊
────────────────────────────────────────────────────────────────␊
1. Edge Functions bundling ␊
────────────────────────────────────────────────────────────────␊
Packaging Edge Functions from netlify/edge-functions directory:␊
- function-1␊
(Edge Functions bundling completed in 1ms)␊
────────────────────────────────────────────────────────────────␊
Netlify Build Complete ␊
────────────────────────────────────────────────────────────────␊
(Netlify Build completed in 1ms)`
Binary file modified packages/build/tests/edge_functions/snapshots/tests.js.snap
Binary file not shown.
8 changes: 4 additions & 4 deletions packages/build/tests/edge_functions/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ test('handles failure when bundling Edge Functions via runCoreSteps function', a
})

test.serial('writes manifest contents to stdout if `debug` is set', async (t) => {
// This file descriptor doesn't exist, but it won't be used anyway since
// `debug` is set.
const systemLogFile = 7
const { returnValue } = await runFixture(t, 'functions_user', {
flags: {
debug: true,
mode: 'buildbot',
buildSteps: ['edge_functions_bundling'],
useRunCoreSteps: true,
systemLogFile,
},
snapshot: false,
})

t.regex(
Expand All @@ -124,7 +125,6 @@ test.serial('writes manifest contents to system logs if `systemLogFile` is set',

await runFixture(t, 'functions_user', {
flags: { debug: false, mode: 'buildbot', systemLogFile: fd },
snapshot: false,
})

const fileContents = await fs.readFile(path, 'utf8')
Expand Down