Skip to content

Commit

Permalink
Enables eslint on the full repo and adds a rule for no only() tests (
Browse files Browse the repository at this point in the history
…withastro#3659)

* enabling eslint on the all packages and tests

* enabling for all packages

* TEMP: adding an only() test to verify it fails CI

* using our eslint config and ignore in CI

* removing the temporary .only() test

* update lock file

* lint: fixing new test with a no-shadow warning

* chore: update lock file
  • Loading branch information
Tony Sullivan authored Jun 22, 2022
1 parent 2024bb2 commit cd3f591
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions e2e/ts-resolution.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const test = base.extend({
},
});

function runTest(test) {
test('client:idle', async ({ page, astro }) => {
function runTest(it) {
it('client:idle', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));

const counter = page.locator('#client-idle');
Expand Down
4 changes: 2 additions & 2 deletions test/astro-css-bundling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe('CSS Bundling', function () {

// test 3: assert all bundled CSS was built and contains CSS
for (const url of builtCSS.keys()) {
const css = await fixture.readFile(url);
expect(css).to.be.ok;
const bundledCss = await fixture.readFile(url);
expect(bundledCss).to.be.ok;
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions test/sass.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Sass', () => {
// TODO: Sass cannot be found on macOS for some reason... Vite issue?
const test = os.platform() === 'darwin' ? it.skip : it;
test('shows helpful error on failure', async () => {
const res = await fixture.fetch('/error').then((res) => res.text());
expect(res).to.include('Undefined variable');
const text = await fixture.fetch('/error').then((res) => res.text());
expect(text).to.include('Undefined variable');
});
});
4 changes: 2 additions & 2 deletions test/ssr-adapter-build-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('Integration buildConfig hook', () => {
if (id === '@my-ssr') {
return id;
} else if (id === 'astro/app') {
const id = viteID(new URL('../dist/core/app/index.js', import.meta.url));
return id;
const viteId = viteID(new URL('../dist/core/app/index.js', import.meta.url));
return viteId;
}
},
load(id) {
Expand Down
3 changes: 1 addition & 2 deletions test/static-build-page-dist-url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { expect } from 'chai';
import { loadFixture } from './test-utils.js';

describe('Static build: pages routes have distURL', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
/** @type {RouteData[]} */
let checkRoutes;
before(async () => {
/** @type {import('./test-utils').Fixture} */
const fixture = await loadFixture({
root: './fixtures/astro pages/',
integrations: [
Expand Down
10 changes: 4 additions & 6 deletions test/tailwindcss.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';

let fixture;

describe('Tailwind', () => {
let fixture;

Expand Down Expand Up @@ -62,10 +60,10 @@ describe('Tailwind', () => {

it('handles Markdown pages', async () => {
const html = await fixture.readFile('/markdown-page/index.html');
const $ = cheerio.load(html);
const bundledCSSHREF = $('link[rel=stylesheet][href^=/assets/]').attr('href');
const bundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/'));
expect(bundledCSS, 'includes used component classes').to.match(/\.bg-purple-600{/);
const $md = cheerio.load(html);
const bundledCSSHREF = $md('link[rel=stylesheet][href^=/assets/]').attr('href');
const mdBundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/'));
expect(mdBundledCSS, 'includes used component classes').to.match(/\.bg-purple-600{/);
});
});
});
4 changes: 2 additions & 2 deletions test/test-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default function () {
if (id === '@my-ssr') {
return id;
} else if (id === 'astro/app') {
const id = viteID(new URL('../dist/core/app/index.js', import.meta.url));
return id;
const viteId = viteID(new URL('../dist/core/app/index.js', import.meta.url));
return viteId;
}
},
load(id) {
Expand Down

0 comments on commit cd3f591

Please sign in to comment.