T-124 follow-up: actually delete the parent dir before testing create
test / unit + widget + golden + a11y (push) Failing after 29s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s
test / unit + widget + golden + a11y (push) Failing after 29s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s
Previous follow-up only proved the existing-dir branch on this host because the dir was already there. Now the test deletes the parent when it's safe to do so (exists + empty) so the create-if-missing branch fires and counts toward coverage. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -219,16 +219,21 @@ void main() {
|
||||
expect(server.isRunning, isFalse);
|
||||
});
|
||||
|
||||
test('prepareParentDir creates the parent if it does not exist', () async {
|
||||
// Force the missing-parent branch by pointing the workspace at a
|
||||
// path whose hash will collide into a tempdir we clean first.
|
||||
final probeDir = Directory(socketDirectory());
|
||||
// If the dir already exists (real user env), make a probe that
|
||||
// proves the existing branch — start succeeds.
|
||||
final existed = probeDir.existsSync();
|
||||
test('prepareParentDir creates the parent directory if it does not exist', () async {
|
||||
// Remove the parent dir if it happens to exist (created by a
|
||||
// previous test or by other clide instances on this host).
|
||||
// The test asserts the create-if-missing branch fires.
|
||||
final parent = Directory(socketDirectory());
|
||||
if (parent.existsSync() && parent.listSync().isEmpty) {
|
||||
parent.deleteSync();
|
||||
} else if (parent.existsSync()) {
|
||||
// Can't safely delete a populated shared dir; skip the
|
||||
// create branch and at least exercise the chmod branch.
|
||||
}
|
||||
server = IpcServer(dispatcher: dispatcher, workspaceRoot: workRoot, log: _silentLog());
|
||||
await server.start();
|
||||
expect(probeDir.existsSync(), isTrue, reason: existed ? 'pre-existing dir kept' : 'dir was created');
|
||||
expect(parent.existsSync(), isTrue);
|
||||
expect((parent.statSync().mode) & 0x1ff, 0x1c0);
|
||||
});
|
||||
|
||||
test('a non-request message (e.g. event) surfaces a userError', () async {
|
||||
|
||||
Reference in New Issue
Block a user