Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(git): advanced test cases for include/exclude filters #5472

Merged
merged 17 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
8 changes: 8 additions & 0 deletions core/src/util/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { dedent, naturalList } from "./string.js"
import pathIsInside from "path-is-inside"
import { join, resolve } from "path"
import { DEFAULT_BUILD_TIMEOUT_SEC, GARDEN_CORE_ROOT, GardenApiVersion } from "../constants.js"
import type { GitScanMode } from "../constants.js"
import { getRootLogger } from "../logger/logger.js"
import stripAnsi from "strip-ansi"
import type { VcsHandler } from "../vcs/vcs.js"
Expand All @@ -44,6 +45,7 @@ import type {
} from "../commands/base.js"
import { validateSchema } from "../config/validation.js"
import fsExtra from "fs-extra"

const { mkdirp, remove } = fsExtra
import { GlobalConfigStore } from "../config-store/global.js"
import { isPromise } from "./objects.js"
Expand Down Expand Up @@ -166,6 +168,7 @@ export type TestGardenOpts = Partial<GardenOpts> & {
onlySpecifiedPlugins?: boolean
remoteContainerAuth?: boolean
clearConfigsOnScan?: boolean
gitScanMode?: GitScanMode
}

export class TestGarden extends Garden {
Expand Down Expand Up @@ -208,6 +211,11 @@ export class TestGarden extends Garden {
params.plugins = opts?.plugins || []
} else {
params = await resolveGardenParams(currentDirectory, { commandInfo: defaultCommandInfo, ...opts })
if (opts?.gitScanMode) {
params.projectConfig.scan = params.projectConfig.scan ?? { git: { mode: opts.gitScanMode } }
params.projectConfig.scan.git = params.projectConfig.scan.git ?? { mode: opts.gitScanMode }
params.projectConfig.scan.git.mode = opts.gitScanMode
}
if (cacheKey) {
paramCache[cacheKey] = cloneDeep({ ...params, log: <any>{}, plugins: [] })
}
Expand Down
5 changes: 2 additions & 3 deletions core/test/unit/src/vcs/git-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { GitRepoHandler } from "../../../../src/vcs/git-repo.js"
import { commonGitHandlerTests } from "./git.js"
import { runGitHandlerTests } from "./git.js"

describe("GitRepoHandler", () => {
commonGitHandlerTests(GitRepoHandler)
runGitHandlerTests("repo")
})
Loading