setup-hugo/__tests__/dart-sass.test.ts
Peter Kurfer 47b2964798
Some checks failed
Check Transpiled JavaScript / Check dist/ (push) Failing after 35s
Continuous Integration / GitHub Actions Test (push) Failing after 8s
Continuous Integration / TypeScript Tests (push) Successful in 48s
fix: add dart-sass to PATH
2024-05-03 16:34:46 +02:00

32 lines
852 B
TypeScript

import fs from 'node:fs'
import path from 'path'
import os from 'node:os'
import { OctokitReleaseLookup } from '../src/asset-lookup'
import { Platform } from '../src/os'
import { DartSassInstaller } from '../src/dart-sass'
let tmpDir = ''
beforeEach(() => {
jest.resetModules()
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-hugo-'))
})
afterEach(() => {
fs.rmSync(tmpDir, { recursive: true })
})
describe('Install dart-sass', () => {
test('Download latest dart-sass', async () => {
const releaseLookup = new OctokitReleaseLookup()
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
const dartSassInstaller = new DartSassInstaller(releaseLookup, platformMock)
expect(
async () =>
await dartSassInstaller.install({
version: 'latest'
})
).not.toThrow()
})
})