Skip to content

Commit 9e344ef

Browse files
author
serverpod_cloud
committed
test(e2e): 17338f8f804dadf9477d55eb1ed45f7bb48d84fe
1 parent 1e6db6d commit 9e344ef

4 files changed

Lines changed: 49 additions & 11 deletions

File tree

serverpod_cloud_cli/lib/commands/deploy/prepare_workspace.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ abstract class WorkspaceProject {
110110
_writeScloudRootPubspec(workspaceRootDir, includedPackagePaths);
111111
_writeProjectServerDirFile(workspaceRootDir, projectPackage.dir);
112112

113-
ScloudIgnore.writeTemplateIfNotExists(rootFolder: workspaceRootDir.path);
113+
final serverDirPath = p.join(
114+
workspaceRootDir.path,
115+
projectPackage.dir.path,
116+
);
117+
ScloudIgnore.writeTemplateIfNotExists(rootFolder: serverDirPath);
114118
}
115119

116120
static String _getPackageName(final Directory packageDirectory) {

serverpod_cloud_cli/lib/util/project_files_writer.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ abstract final class ProjectFilesWriter {
6363
final workspaceRootDir = _findWorkspaceRootDir(Directory(projectDirectory));
6464

6565
try {
66-
ScloudIgnore.writeTemplateIfNotExists(
67-
rootFolder: workspaceRootDir?.path ?? projectDirectory,
68-
);
66+
ScloudIgnore.writeTemplateIfNotExists(rootFolder: projectDirectory);
6967
} on Exception catch (e, s) {
7068
throw FailureException.nested(
7169
e,

serverpod_cloud_cli/test_integration/commands/deploy_command_test.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,40 @@ dependencies:
806806
),
807807
);
808808
});
809+
810+
test(
811+
'then .scloudignore is created in the server directory, not in workspace root',
812+
() async {
813+
await cliCommandFuture;
814+
815+
final workspaceRootDir = p.join(d.sandbox, 'monorepo');
816+
final serverDir = p.join(
817+
workspaceRootDir,
818+
'project',
819+
'project_server',
820+
);
821+
final scloudIgnoreInWorkspaceRoot = p.join(
822+
workspaceRootDir,
823+
'.scloudignore',
824+
);
825+
final scloudIgnoreInServerDir = p.join(serverDir, '.scloudignore');
826+
827+
expect(
828+
File(scloudIgnoreInServerDir).existsSync(),
829+
isTrue,
830+
reason:
831+
'.scloudignore should be created in the server directory: $serverDir',
832+
);
833+
834+
expect(
835+
File(scloudIgnoreInWorkspaceRoot).existsSync(),
836+
isFalse,
837+
reason:
838+
'.scloudignore should NOT be created in the workspace root. '
839+
'It should be in the server directory instead.',
840+
);
841+
},
842+
);
809843
},
810844
);
811845
});

serverpod_cloud_cli/test_integration/commands/project_command/link_command_test.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,20 @@ project:
971971
});
972972

973973
test(
974-
'then .scloudignore is created in the workspace root dir',
974+
'then .scloudignore is created in the project server directory, not in workspace root',
975975
() async {
976976
await commandResult;
977977
final expected = d.dir('topdir', [
978978
d.dir('workspace_dir', [
979-
d.file(
980-
'.scloudignore',
981-
contains(
982-
'This file specifies which files and directories should be ignored',
979+
d.nothing('.scloudignore'),
980+
d.dir('project_server', [
981+
d.file(
982+
'.scloudignore',
983+
contains(
984+
'This file specifies which files and directories should be ignored',
985+
),
983986
),
984-
),
985-
d.dir('project_server', [d.nothing('.scloudignore')]),
987+
]),
986988
d.dir('project_client', [d.nothing('.scloudignore')]),
987989
]),
988990
]);

0 commit comments

Comments
 (0)