diff --git a/linters/terrascan/terrascan.test.ts b/linters/terrascan/terrascan.test.ts index 45e5e6f15..c623a840e 100644 --- a/linters/terrascan/terrascan.test.ts +++ b/linters/terrascan/terrascan.test.ts @@ -1,3 +1,11 @@ import { linterCheckTest } from "tests"; +import { TrunkLintDriver } from "tests/driver"; -linterCheckTest({ linterName: "terrascan" }); +// NOTE(Tyler): Terrascan will sometimes fail due to a git error: +// "failed to fetch references from git repo. error: 'some refs were not updated'" +// Add a remote in order to avoid this error. +const preCheck = async (driver: TrunkLintDriver) => { + await driver.gitDriver?.addRemote("origin", driver.getSandbox()); +}; + +linterCheckTest({ linterName: "terrascan", preCheck });