0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
lilnasy 2023-09-05 18:03:21 +00:00 committed by astrobot-houston
parent 7d95bd9baa
commit cde0cc4093
2 changed files with 29 additions and 26 deletions

View file

@ -13,7 +13,10 @@ module.exports = {
rules: {
// These off/configured-differently-by-default rules fit well for us
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: "^_", ignoreRestSiblings: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'no-only-tests/no-only-tests': 'error',
'@typescript-eslint/no-shadow': ['error'],
'no-console': 'warn',

View file

@ -1,36 +1,36 @@
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
const cssAssetReferenceRegExp = /_astro\/[A-Za-z0-9\-]+\.[a0-9a-f]{8}\.css/g
const cssAssetReferenceRegExp = /_astro\/[A-Za-z0-9\-]+\.[a0-9a-f]{8}\.css/g;
describe("When Vite's preloadModule polyfill is used", async () => {
let fixture;
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/css-dangling-references/'
});
root: './fixtures/css-dangling-references/',
});
await fixture.build();
});
it('there are no references to deleted CSS chunks', async () => {
const fileNames = await fixture.readdir('/_astro/')
const filePaths = fileNames.map(filename => '_astro/' + filename)
const expectations =
filePaths
.filter(filePath => filePath.endsWith('js'))
.map(async filePath => {
const contents = await fixture.readFile(filePath)
const cssReferences = contents.match(cssAssetReferenceRegExp)
if (cssReferences === null) return
expect(filePaths).to.contain.members(cssReferences, filePath + ' contains a reference to a deleted css asset: ' + cssReferences)
})
await Promise.all(expectations)
})
})
it('there are no references to deleted CSS chunks', async () => {
const fileNames = await fixture.readdir('/_astro/');
const filePaths = fileNames.map((filename) => '_astro/' + filename);
const expectations = filePaths
.filter((filePath) => filePath.endsWith('js'))
.map(async (filePath) => {
const contents = await fixture.readFile(filePath);
const cssReferences = contents.match(cssAssetReferenceRegExp);
if (cssReferences === null) return;
expect(filePaths).to.contain.members(
cssReferences,
filePath + ' contains a reference to a deleted css asset: ' + cssReferences
);
});
await Promise.all(expectations);
});
});