0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/astro/test/build-readonly-file.test.js
Nworm 903eace233
fix(core): build failure caused by read-only files (#10195)
* fix(core): build failure caused by read-only files

* test: fix fixtures/build-readonly-file

* other:  format code
2024-02-23 11:36:53 +00:00

51 lines
1.1 KiB
JavaScript

import { after, before, describe, it } from 'node:test';
import { fileURLToPath } from 'url';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';
describe('When a read-only file exists in /public (static)', () => {
let fixture;
let testFilePath;
before(async () => {
fixture = await loadFixture({
root: './fixtures/build-readonly-file/',
});
testFilePath = fileURLToPath(fixture.config.publicDir) + 'test.txt';
fs.chmodSync(testFilePath, 0o444);
});
it('Gets successfully build', async () => {
await fixture.build();
});
after(() => {
fs.chmodSync(testFilePath, 0o666);
fixture.clean();
});
});
describe('When a read-only file exists in /public (server)', () => {
let fixture;
let testFilePath;
before(async () => {
fixture = await loadFixture({
root: './fixtures/build-readonly-file/',
adapter: testAdapter(),
});
testFilePath = fileURLToPath(fixture.config.publicDir) + 'test.txt';
fs.chmodSync(testFilePath, 0o444);
});
it('Gets successfully build', async () => {
await fixture.build();
});
after(() => {
fs.chmodSync(testFilePath, 0o666);
fixture.clean();
});
});