Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
proxies used by some third-party runners.
- `WIREIT_PARALLEL`, `WIREIT_WATCH_POLL_MS`, and `WIREIT_MAX_OPEN_FILES` now
reject any value that is not a positive integer, such as `2abc` or `1.5`.
- An `"env"` setting that is a non-empty array, such as `["FOO"]`, now reports
`Expected an object` instead of crashing Wireit and the VSCode extension with
an internal error.

### Changed

Expand Down
1 change: 1 addition & 0 deletions src/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ export class Analyzer {
},
},
});
return {};
}
if (envNode.children === undefined) {
return {};
Expand Down
33 changes: 33 additions & 0 deletions src/test/errors-analysis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,39 @@ void test(
}),
);

void test(
'env must be an object even when it has entries',
rigTest(async ({rig}) => {
await rig.write({
'package.json': {
scripts: {
a: 'wireit',
},
wireit: {
a: {
command: 'true',
env: ['FOO'],
},
},
},
});
const result = rig.exec('npm run a');
const done = await result.exit;
assert.equal(done.code, 1);
checkScriptOutput(
done.stderr,
`
❌ package.json:8:14 Expected an object
"env": [
~
"FOO"
~~~~~~~~~~~~~
]
~~~~~~~`,
);
}),
);

void test(
'env entry value must be a string or object',
rigTest(async ({rig}) => {
Expand Down
Loading