Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy authored and astrobot-houston committed Sep 5, 2023
1 parent 7d95bd9 commit cde0cc4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
50 changes: 25 additions & 25 deletions packages/astro/test/css-dangling-references.test.js
Original file line number Diff line number Diff line change
@@ -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);
});
});

0 comments on commit cde0cc4

Please sign in to comment.