Skip to content

Commit

Permalink
build: Tweak approval tests for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Dec 6, 2024
1 parent e2f3cf2 commit cfe068d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ jobs:
pipx install algokit --python 3.12.6
algokit localnet reset --update
pipx install git+https://github.com/algorandfoundation/puya --python 3.12.6
test-script: npm run test:ci
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test:approvals": "vitest run tests/approvals.spec.ts",
"test:expected-output": "vitest run tests/expected-output.spec.ts",
"test:coverage": "vitest run --coverage",
"test:ci": "vitest run --coverage --reporter junit --outputFile test-results.xml",
"test:ci": "cross-env NODE_ENV=ci vitest run --coverage --reporter junit --outputFile test-results.xml",
"install-local-packages": "npm run algo-ts",
"watch-local-packages": "npm run algo-ts:build:watch",
"algo-ts": "run-s algo-ts:*",
Expand Down Expand Up @@ -60,6 +60,7 @@
"better-npm-audit": "3.11.0",
"conventional-changelog-conventionalcommits": "^8.0.0",
"copyfiles": "2.4.1",
"cross-env": "^7.0.3",
"eslint": "9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
Expand Down
15 changes: 10 additions & 5 deletions tests/approvals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import { buildCompileOptions } from '../src/compile-options'
import { isErrorOrCritical, LoggingContext, LogLevel } from '../src/logger'
import { defaultPuyaOptions } from '../src/puya/options'
import { invariant } from '../src/util'
import { Environment } from './constants'

describe('Approvals', async () => {
await rimraf('tests/approvals/out')
if (Environment.IsCi) {
await rimraf('tests/approvals/out')
}

using logCtx = LoggingContext.create()
const result = compile(
Expand Down Expand Up @@ -55,10 +58,12 @@ describe('Approvals', async () => {
})

it('There should be no differences to committed changes', () => {
// // Run git add to force line ending changes
// sync('git', ['add', '.'], {
// stdio: 'inherit',
// })
if (Environment.IsCi) {
// Run git add to force line ending changes
sync('git', ['add', '.'], {
stdio: 'inherit',
})
}
const result = sync('git', ['status', '--porcelain'], {
stdio: 'pipe',
})
Expand Down
3 changes: 3 additions & 0 deletions tests/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const Environment = {
IsCi: process.env.NODE_ENV === 'ci',
} as const

0 comments on commit cfe068d

Please sign in to comment.