Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/config/src/validate/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ export const POST_NORMALIZE_VALIDATIONS = [
message: 'must be a string.',
example: () => ({ build: { edge_functions: 'edge-functions' } }),
},
{
property: 'build.edge_functions_import_map',
check: isString,
message: 'must be a string.',
example: () => ({
build: { edge_functions_import_map: 'path/to/import_map.json' },
}),
},
{
property: 'functions.*',
check: isPlainObj,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
edge_functions_import_map = ["not", "a", "string"]
21 changes: 21 additions & 0 deletions packages/config/tests/validate/snapshots/tests.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,27 @@ Generated by [AVA](https://avajs.dev).
`When resolving config file packages/config/tests/validate/fixtures/build_edge_functions_parent/netlify.toml:␊
Configuration property "build.edge_functions" "edge_functions_dir" must be inside the repository root directory.`

## build.edge_functions_import_map: string

> Snapshot 1

`When resolving config file packages/config/tests/validate/fixtures/build_edge_functions_import_map/netlify.toml:␊
Configuration property build.edge_functions_import_map must be a string.␊
Invalid syntax␊
[build]␊
edge_functions_import_map = [␊
"not",␊
"a",␊
"string"␊
]␊
Valid syntax␊
[build]␊
edge_functions_import_map = "path/to/import_map.json"`

## build.base: string

> Snapshot 1
Expand Down
Binary file modified packages/config/tests/validate/snapshots/tests.js.snap
Binary file not shown.
5 changes: 5 additions & 0 deletions packages/config/tests/validate/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ test('build.edge_functions: parent directory', async (t) => {
t.snapshot(normalizeOutput(output))
})

test('build.edge_functions_import_map: string', async (t) => {
const output = await new Fixture('./fixtures/build_edge_functions_import_map').runWithConfig()
t.snapshot(normalizeOutput(output))
})

test('build.base: string', async (t) => {
const output = await new Fixture('./fixtures/build_base_string').runWithConfig()
t.snapshot(normalizeOutput(output))
Expand Down