Skip to content

Commit a973943

Browse files
committed
chore: add test for build.environment
1 parent ca1d575 commit a973943

File tree

7 files changed

+43
-0
lines changed

7 files changed

+43
-0
lines changed

packages/config-schema/tests/fixtures/build-errors/snapshot.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
},
3737
"schemaPath": "#/definitions/EdgeFunctionPath/type",
3838
},
39+
{
40+
"instancePath": "/build/environment/FOO",
41+
"keyword": "type",
42+
"message": "must be string",
43+
"params": {
44+
"type": "string",
45+
},
46+
"schemaPath": "#/definitions/Environment/additionalProperties/type",
47+
},
3948
{
4049
"instancePath": "/build/publish",
4150
"keyword": "type",

packages/config-schema/tests/fixtures/build-errors/test.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ publish = 1
44
command = 1
55
edge_functions = 1
66
abcd = "string"
7+
8+
[build.environment]
9+
FOO = 1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"errors": [
3+
{
4+
"instancePath": "/build/environment",
5+
"keyword": "type",
6+
"message": "must be object",
7+
"params": {
8+
"type": "object",
9+
},
10+
"schemaPath": "#/definitions/Environment/type",
11+
},
12+
],
13+
"valid": false,
14+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
environment = 1

packages/config-schema/tests/fixtures/build-pass/test.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ base = "static/"
33
publish = "build-output/"
44
command = "echo 'hello'"
55
edge_functions = "edge-functions-path/"
6+
7+
[build.environment]
8+
FOO = "FOO"

packages/config-schema/tests/fixtures/context-errors/snapshot.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
},
1010
"schemaPath": "#/additionalProperties",
1111
},
12+
{
13+
"instancePath": "/context/deploy-preview/environment/ACCESS_TOKEN",
14+
"keyword": "type",
15+
"message": "must be string",
16+
"params": {
17+
"type": "string",
18+
},
19+
"schemaPath": "#/definitions/Environment/additionalProperties/type",
20+
},
1221
{
1322
"instancePath": "/context/dev",
1423
"keyword": "additionalProperties",

packages/config-schema/tests/fixtures/context-errors/test.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ package = "@netlify/plugin-sitemap"
1111
[context.deploy-preview.other]
1212
ACCESS_TOKEN = "not so secret"
1313

14+
[context.deploy-preview.environment]
15+
ACCESS_TOKEN = 1
16+
1417
[context.dev.this]
1518
NODE_ENV = "development"
1619

0 commit comments

Comments
 (0)