Skip to content

Commit

Permalink
chore: remove execa mock after dev server closed (#4633)
Browse files Browse the repository at this point in the history
#4625

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
danez and kodiakhq[bot] authored May 30, 2022
1 parent 8de190b commit 4ff745b
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions tests/integration/620.serving-functions-rust.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@ const WAIT_WRITE = 1000

test('Updates a Rust function when a file is modified', async (t) => {
await withSiteBuilder('rust-function-update', async (builder) => {
await builder
.withNetlifyToml({
config: {
build: { publish: 'public' },
functions: { directory: 'functions' },
},
})
.withContentFiles([
{
path: 'functions/rust-func/Cargo.toml',
content: `[package]
name = "rust-func"`,
},
{
path: 'functions/rust-func/src/main.rs',
content: `<mock main.rs>`,
},
])
.buildAsync()

const originalBody = 'Netlify likes Rust'
const updatedBody = 'Netlify *loves* Rust'

Expand All @@ -46,7 +26,7 @@ test('Updates a Rust function when a file is modified', async (t) => {
stdout: ''
}
}
if (args[0].includes('local-functions-proxy')) {
proxyCallCount++
Expand All @@ -68,13 +48,33 @@ test('Updates a Rust function when a file is modified', async (t) => {
})
`)

await withDevServer(
{
cwd: builder.directory,
env: { ...execaMock, NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE: 'true' },
},
async ({ outputBuffer, port }) => {
try {
try {
await builder
.withNetlifyToml({
config: {
build: { publish: 'public' },
functions: { directory: 'functions' },
},
})
.withContentFiles([
{
path: 'functions/rust-func/Cargo.toml',
content: `[package]
name = "rust-func"`,
},
{
path: 'functions/rust-func/src/main.rs',
content: `<mock main.rs>`,
},
])
.buildAsync()

await withDevServer(
{
cwd: builder.directory,
env: { ...execaMock, NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE: 'true' },
},
async ({ outputBuffer, port }) => {
await tryAndLogOutput(async () => {
t.is(await got(`http://localhost:${port}/.netlify/functions/rust-func`).text(), originalBody)
}, outputBuffer)
Expand All @@ -97,10 +97,10 @@ test('Updates a Rust function when a file is modified', async (t) => {
),
outputBuffer,
)
} finally {
await removeExecaMock()
}
},
)
},
)
} finally {
await removeExecaMock()
}
})
})

1 comment on commit 4ff745b

@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: 287 MB

Please sign in to comment.