Skip to content

Commit

Permalink
Merge branch 'main' into refactor/replace-got/server.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hereje authored Dec 26, 2023
2 parents ba17879 + f396f61 commit 85727ca
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 91 deletions.
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"@babel/preset-react": "7.22.5",
"@netlify/eslint-config-node": "7.0.0",
"@netlify/functions": "2.4.0",
"@sindresorhus/slugify": "^2.2.1",
"@types/fs-extra": "11.0.4",
"@types/inquirer": "9.0.7",
"@types/node": "20.9.0",
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/commands/addons/addons.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const routes = [
]
describe.concurrent('command-addons', () => {
test('netlify addons:list', async (t) => {
await withSiteBuilder('site-with-addons', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.buildAsync()

await withMockApi(routes, async ({ apiUrl }) => {
Expand All @@ -30,7 +30,7 @@ describe.concurrent('command-addons', () => {
})

test('netlify addons:list --json', async (t) => {
await withSiteBuilder('site-with-addons', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.buildAsync()

await withMockApi(routes, async ({ apiUrl }) => {
Expand All @@ -43,7 +43,7 @@ describe.concurrent('command-addons', () => {
})

test('netlify addons:create demo', async (t) => {
await withSiteBuilder('site-with-addons', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.buildAsync()

const createRoutes = [
Expand All @@ -68,7 +68,7 @@ describe.concurrent('command-addons', () => {
})

test('After creation netlify addons:list --json', async (t) => {
await withSiteBuilder('site-with-addons', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.buildAsync()

const withExistingAddon = [
Expand All @@ -94,7 +94,7 @@ describe.concurrent('command-addons', () => {
})

test('netlify addons:config demo', async (t) => {
await withSiteBuilder('site-with-addons', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.buildAsync()

const configRoutes = [
Expand Down Expand Up @@ -128,7 +128,7 @@ describe.concurrent('command-addons', () => {
})

test('netlify addon:delete demo', async (t) => {
await withSiteBuilder('site-with-addons', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.buildAsync()

const deleteRoutes = [
Expand Down
28 changes: 14 additions & 14 deletions tests/integration/commands/build/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ routesWithCommand.splice(0, 1, { path: 'sites/site_id', response: siteInfoWithCo

describe.concurrent('command/build', () => {
test('should use build command from UI', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({ config: {} }).withStateFile({ siteId: siteInfo.id })

await builder.buildAsync()
Expand All @@ -78,7 +78,7 @@ describe.concurrent('command/build', () => {
})

test('should use build command from UI with build plugin', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withNetlifyToml({
config: {
Expand Down Expand Up @@ -113,7 +113,7 @@ describe.concurrent('command/build', () => {
})

test('should print output for a successful command', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } })
.withStateFile({ siteId: siteInfo.id })
Expand All @@ -127,7 +127,7 @@ describe.concurrent('command/build', () => {
})

test('should print output for a failed command', async (t) => {
await withSiteBuilder('failure-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({ config: { build: { command: 'doesNotExist' } } }).withStateFile({ siteId: siteInfo.id })

await builder.buildAsync()
Expand All @@ -139,7 +139,7 @@ describe.concurrent('command/build', () => {
})

test('should run in dry mode when the --dry flag is set', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } })
.withStateFile({ siteId: siteInfo.id })
Expand All @@ -153,7 +153,7 @@ describe.concurrent('command/build', () => {
})

test('should run the production context when context is not defined', async (t) => {
await withSiteBuilder('context-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({
config: {
build: { command: 'echo testCommand' },
Expand All @@ -168,7 +168,7 @@ describe.concurrent('command/build', () => {
})

test('should run the staging context command when the --context option is set to staging', async (t) => {
await withSiteBuilder('context-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({
config: {
build: { command: 'echo testCommand' },
Expand All @@ -183,7 +183,7 @@ describe.concurrent('command/build', () => {
})

test('should run the staging context command when the context env variable is set', async (t) => {
await withSiteBuilder('context-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({
config: {
build: { command: 'echo testCommand' },
Expand All @@ -202,7 +202,7 @@ describe.concurrent('command/build', () => {
})

test('should print debug information when the --debug flag is set', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } })
.withStateFile({ siteId: siteInfo.id })
Expand All @@ -216,7 +216,7 @@ describe.concurrent('command/build', () => {
})

test('should use root directory netlify.toml when runs in subdirectory', async (t) => {
await withSiteBuilder('subdir-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } })
.withStateFile({ siteId: siteInfo.id })
Expand All @@ -231,7 +231,7 @@ describe.concurrent('command/build', () => {
})

test('should error when using invalid netlify.toml', async (t) => {
await withSiteBuilder('wrong-config-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({ config: { build: { command: false } } })

await builder.buildAsync()
Expand All @@ -243,7 +243,7 @@ describe.concurrent('command/build', () => {
})

test('should error when a site id is missing', async (t) => {
await withSiteBuilder('no-site-id-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } })

await builder.buildAsync()
Expand All @@ -260,7 +260,7 @@ describe.concurrent('command/build', () => {
})

test('should not require a linked site when offline flag is set', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } }).buildAsync()

await runBuildCommand(t, builder.directory, {
Expand All @@ -272,7 +272,7 @@ describe.concurrent('command/build', () => {
})

test('should not send network requests when offline flag is set', async (t) => {
await withSiteBuilder('success-site', async (builder) => {
await withSiteBuilder(t, async (builder) => {
await builder.withNetlifyToml({ config: { build: { command: 'echo testCommand' } } }).buildAsync()

await withMockApi(routes, async ({ apiUrl, requests }) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/commands/dev/dev.geo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { callCli } from '../../utils/call-cli.js'
import { withSiteBuilder } from '../../utils/site-builder.ts'

test('should throw if invalid country arg is passed', async (t) => {
await withSiteBuilder('site-env', async (builder) => {
await builder.buildAsync()
await withSiteBuilder(t, async (builder) => {
await builder.build()

const options = {
cwd: builder.directory,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/commands/dev/images.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { withSiteBuilder } from '../../utils/site-builder.ts'

describe.concurrent('commands/dev/images', () => {
test(`should support remote image transformations`, async (t) => {
await withSiteBuilder('site-with-image-transformations', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withNetlifyToml({
config: {
Expand Down Expand Up @@ -50,7 +50,7 @@ describe.concurrent('commands/dev/images', () => {
})

test(`should support local image transformations for relative paths`, async (t) => {
await withSiteBuilder('site-with-image-transformations', async (builder) => {
await withSiteBuilder(t, async (builder) => {
builder
.withContentFile({
content: `
Expand Down
Loading

0 comments on commit 85727ca

Please sign in to comment.