Skip to content

Commit

Permalink
fix: update ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xzf0587 committed Jun 6, 2023
1 parent d96d8e2 commit 586d7a1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1404,10 +1404,9 @@ describe("debugMigration", () => {
});
});

describe("updateGitignore", async () => {
describe("updateGitignore", () => {
const appName = randomAppName();
const projectPath = path.join(os.tmpdir(), appName);
const migrationContext: MigrationContext = await mockMigrationContext(projectPath);

beforeEach(async () => {
await fs.ensureDir(projectPath);
Expand All @@ -1418,18 +1417,21 @@ describe("updateGitignore", async () => {
});

it("should update existing gitignore file", async () => {
const migrationContext: MigrationContext = await mockMigrationContext(projectPath);
await copyTestProject("happyPath", projectPath);

await generateAppYml(migrationContext);
await MigratorV3.updateGitignore(migrationContext);

await assertFileContent(projectPath, ".gitignore", "whenGitignoreExist");
});

it("should create new gitignore file when no gitignore file exists", async () => {
const migrationContext: MigrationContext = await mockMigrationContext(projectPath);
await copyTestProject("happyPath", projectPath);

await fs.remove(path.join(projectPath, ".gitignore"));

await generateAppYml(migrationContext);
await MigratorV3.updateGitignore(migrationContext);

await assertFileContent(projectPath, ".gitignore", "whenGitignoreNotExist");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ subscriptionInfo.json
build
.fx/configs/config.local.json
.fx/states/state.local.json
env/.env.*
teamsfx/backup/*
env/.env.*.user
env/.env.local
.backup/*
/devTools/
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
env/.env.*
teamsfx/backup/*

env/.env.*.user
env/.env.local
.backup/*
/devTools/

0 comments on commit 586d7a1

Please sign in to comment.