From cde0cc409383e2e3fcb6b2bded432bad8d7c40ab Mon Sep 17 00:00:00 2001 From: lilnasy Date: Tue, 5 Sep 2023 18:03:21 +0000 Subject: [PATCH] [ci] format --- .eslintrc.cjs | 5 +- .../test/css-dangling-references.test.js | 50 +++++++++---------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 9a6436767e..ad881979bc 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -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', diff --git a/packages/astro/test/css-dangling-references.test.js b/packages/astro/test/css-dangling-references.test.js index 4f3c6e77d5..c38aa854d1 100644 --- a/packages/astro/test/css-dangling-references.test.js +++ b/packages/astro/test/css-dangling-references.test.js @@ -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) - }) -}) \ No newline at end of file + 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); + }); +});