diff --git a/packages/astro/test/astro-not-response.test.js b/packages/astro/test/astro-not-response.nodetest.js
similarity index 81%
rename from packages/astro/test/astro-not-response.test.js
rename to packages/astro/test/astro-not-response.nodetest.js
index 76c7e5c35b..e7d23d18d0 100644
--- a/packages/astro/test/astro-not-response.test.js
+++ b/packages/astro/test/astro-not-response.nodetest.js
@@ -1,4 +1,5 @@
-import { expect, assert } from 'chai';
+import assert from 'node:assert/strict';
+import { after, describe, before, it } from 'node:test';
import { loadFixture } from './test-utils.js';
// Asset bundling
@@ -23,8 +24,9 @@ describe('Not returning responses', () => {
try {
await fixture.build();
} catch (e) {
- expect(e).to.be.instanceOf(
- Error,
+ assert.equal(
+ e instanceof Error,
+ true,
'Only instance of Response can be returned from an Astro file'
);
return null;
diff --git a/packages/astro/test/astro-pageDirectoryUrl.test.js b/packages/astro/test/astro-pageDirectoryUrl.nodetest.js
similarity index 63%
rename from packages/astro/test/astro-pageDirectoryUrl.test.js
rename to packages/astro/test/astro-pageDirectoryUrl.nodetest.js
index 43e1b8cb52..040c614ea2 100644
--- a/packages/astro/test/astro-pageDirectoryUrl.test.js
+++ b/packages/astro/test/astro-pageDirectoryUrl.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
import { loadFixture } from './test-utils.js';
describe('build format', () => {
@@ -17,9 +18,9 @@ describe('build format', () => {
});
it('outputs', async () => {
- expect(await fixture.readFile('/client.html')).to.be.ok;
- expect(await fixture.readFile('/nested-md.html')).to.be.ok;
- expect(await fixture.readFile('/nested-astro.html')).to.be.ok;
+ assert.ok(await fixture.readFile('/client.html'));
+ assert.ok(await fixture.readFile('/nested-md.html'));
+ assert.ok(await fixture.readFile('/nested-astro.html'));
});
});
@@ -38,9 +39,9 @@ describe('build format', () => {
});
it('outputs', async () => {
- expect(await fixture.readFile('/client.html')).to.be.ok;
- expect(await fixture.readFile('/nested-md/index.html')).to.be.ok;
- expect(await fixture.readFile('/nested-astro/index.html')).to.be.ok;
+ assert.ok(await fixture.readFile('/client.html'));
+ assert.ok(await fixture.readFile('/nested-md/index.html'));
+ assert.ok(await fixture.readFile('/nested-astro/index.html'));
});
});
});
diff --git a/packages/astro/test/astro-pagination-root-spread.test.js b/packages/astro/test/astro-pagination-root-spread.nodetest.js
similarity index 82%
rename from packages/astro/test/astro-pagination-root-spread.test.js
rename to packages/astro/test/astro-pagination-root-spread.nodetest.js
index 4b96a67906..9c9ea4e45d 100644
--- a/packages/astro/test/astro-pagination-root-spread.test.js
+++ b/packages/astro/test/astro-pagination-root-spread.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
@@ -26,7 +27,7 @@ describe('Pagination root', () => {
Object.entries(prevMap).map(async ([curr, prev]) => {
const html = await fixture.readFile(curr + 'index.html');
const $ = cheerio.load(html);
- expect($('#prev').attr('href')).to.equal(prev);
+ assert.equal($('#prev').attr('href'), prev);
})
);
});
diff --git a/packages/astro/test/astro-pagination.test.js b/packages/astro/test/astro-pagination.nodetest.js
similarity index 69%
rename from packages/astro/test/astro-pagination.test.js
rename to packages/astro/test/astro-pagination.nodetest.js
index 5fb3a8dbde..44aaec773f 100644
--- a/packages/astro/test/astro-pagination.test.js
+++ b/packages/astro/test/astro-pagination.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
@@ -20,7 +21,7 @@ describe('Pagination', () => {
'/posts/optional-root-page/2/index.html',
'/posts/optional-root-page/3/index.html',
]) {
- expect(await fixture.readFile(file)).to.be.ok;
+ assert.ok(await fixture.readFile(file));
}
});
@@ -30,7 +31,7 @@ describe('Pagination', () => {
'/posts/named-root-page/2/index.html',
'/posts/named-root-page/3/index.html',
]) {
- expect(await fixture.readFile(file)).to.be.ok;
+ assert.ok(await fixture.readFile(file));
}
});
@@ -44,24 +45,24 @@ describe('Pagination', () => {
params.map(async ({ color, p }) => {
const html = await fixture.readFile(`/posts/${color}/${p}/index.html`);
const $ = cheerio.load(html);
- expect($('#page-param').text()).to.equal(p);
- expect($('#currentPage').text()).to.equal(p);
- expect($('#filter').text()).to.equal(color);
+ assert.equal($('#page-param').text(), p);
+ assert.equal($('#currentPage').text(), p);
+ assert.equal($('#filter').text(), color);
const prevHref = $('#prev').attr('href');
const nextHref = $('#next').attr('href');
if (color === 'red') {
- expect(prevHref).to.be.undefined;
- expect(nextHref).to.be.undefined;
+ assert.equal(prevHref, undefined);
+ assert.equal(nextHref, undefined);
}
if (color === 'blue' && p === '1') {
- expect(prevHref).to.be.undefined;
- expect(nextHref).to.equal('/posts/blue/2');
+ assert.equal(prevHref, undefined);
+ assert.equal(nextHref, '/posts/blue/2');
}
if (color === 'blue' && p === '2') {
- expect(prevHref).to.equal('/posts/blue/1');
- expect(nextHref).to.be.undefined;
+ assert.equal(prevHref, '/posts/blue/1');
+ assert.equal(nextHref, undefined);
}
})
);
diff --git a/packages/astro/test/astro-public.nodetest.js b/packages/astro/test/astro-public.nodetest.js
new file mode 100644
index 0000000000..056f626478
--- /dev/null
+++ b/packages/astro/test/astro-public.nodetest.js
@@ -0,0 +1,19 @@
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
+import { loadFixture } from './test-utils.js';
+
+describe('Public', () => {
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({ root: './fixtures/astro-public/' });
+ await fixture.build();
+ });
+
+ it('css and js files do not get bundled', async () => {
+ let indexHtml = await fixture.readFile('/index.html');
+ assert.equal(indexHtml.includes(''), true);
+ assert.equal(indexHtml.includes(''), true);
+ assert.equal(indexHtml.includes('
'), true);
+ });
+});
diff --git a/packages/astro/test/astro-public.test.js b/packages/astro/test/astro-public.test.js
deleted file mode 100644
index 9f4094e1c8..0000000000
--- a/packages/astro/test/astro-public.test.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { expect } from 'chai';
-import { loadFixture } from './test-utils.js';
-
-describe('Public', () => {
- let fixture;
-
- before(async () => {
- fixture = await loadFixture({ root: './fixtures/astro-public/' });
- await fixture.build();
- });
-
- it('css and js files do not get bundled', async () => {
- let indexHtml = await fixture.readFile('/index.html');
- expect(indexHtml).to.include('');
- expect(indexHtml).to.include('');
- expect(indexHtml).to.include('
');
- });
-});
diff --git a/packages/astro/test/astro-response.test.js b/packages/astro/test/astro-response.nodetest.js
similarity index 78%
rename from packages/astro/test/astro-response.test.js
rename to packages/astro/test/astro-response.nodetest.js
index c77e7bad34..3a1bc306f2 100644
--- a/packages/astro/test/astro-response.test.js
+++ b/packages/astro/test/astro-response.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { after, describe, before, it } from 'node:test';
import { loadFixture } from './test-utils.js';
// Asset bundling
@@ -21,6 +22,6 @@ describe('Returning responses', () => {
it('Works from a page', async () => {
let response = await fixture.fetch('/not-found');
- expect(response.status).to.equal(404);
+ assert.equal(response.status, 404);
});
});
diff --git a/packages/astro/test/astro-slot-with-client.test.js b/packages/astro/test/astro-slot-with-client.nodetest.js
similarity index 77%
rename from packages/astro/test/astro-slot-with-client.test.js
rename to packages/astro/test/astro-slot-with-client.nodetest.js
index 4ad26dee41..d0789689d5 100644
--- a/packages/astro/test/astro-slot-with-client.test.js
+++ b/packages/astro/test/astro-slot-with-client.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
@@ -14,12 +15,12 @@ describe('Slots with client: directives', () => {
it('Tags of dynamic tags works', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
- expect($('script')).to.have.a.lengthOf(1);
+ assert.equal($('script').length, 1);
});
it('Astro slot tags are cleaned', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
- expect($('astro-slot')).to.have.a.lengthOf(0);
+ assert.equal($('astro-slot').length, 0);
});
});
diff --git a/packages/astro/test/astro-slots.test.js b/packages/astro/test/astro-slots.nodetest.js
similarity index 56%
rename from packages/astro/test/astro-slots.test.js
rename to packages/astro/test/astro-slots.nodetest.js
index 69a0025e1f..5e916685f5 100644
--- a/packages/astro/test/astro-slots.test.js
+++ b/packages/astro/test/astro-slots.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
@@ -14,59 +15,59 @@ describe('Slots', () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
- expect($('#a').text().trim()).to.equal('A');
- expect($('#b').text().trim()).to.equal('B');
- expect($('#c').text().trim()).to.equal('C');
- expect($('#default').text().trim()).to.equal('Default');
+ assert.equal($('#a').text().trim(), 'A');
+ assert.equal($('#b').text().trim(), 'B');
+ assert.equal($('#c').text().trim(), 'C');
+ assert.equal($('#default').text().trim(), 'Default');
});
it('Dynamic named slots work', async () => {
const html = await fixture.readFile('/dynamic/index.html');
const $ = cheerio.load(html);
- expect($('#a').text().trim()).to.equal('A');
- expect($('#b').text().trim()).to.equal('B');
- expect($('#c').text().trim()).to.equal('C');
- expect($('#default').text().trim()).to.equal('Default');
+ assert.equal($('#a').text().trim(), 'A');
+ assert.equal($('#b').text().trim(), 'B');
+ assert.equal($('#c').text().trim(), 'C');
+ assert.equal($('#default').text().trim(), 'Default');
});
it('Conditional named slots work', async () => {
const html = await fixture.readFile('/conditional/index.html');
const $ = cheerio.load(html);
- expect($('#a').text().trim()).to.equal('A');
- expect($('#b').text().trim()).to.equal('B');
- expect($('#c').text().trim()).to.equal('C');
- expect($('#default').text().trim()).to.equal('Default');
+ assert.equal($('#a').text().trim(), 'A');
+ assert.equal($('#b').text().trim(), 'B');
+ assert.equal($('#c').text().trim(), 'C');
+ assert.equal($('#default').text().trim(), 'Default');
});
it('Slots of a component render fallback content by default', async () => {
const html = await fixture.readFile('/fallback/index.html');
const $ = cheerio.load(html);
- expect($('#default')).to.have.lengthOf(1);
+ assert.equal($('#default').length, 1);
});
it('Slots of a page render fallback content', async () => {
const html = await fixture.readFile('/fallback-own/index.html');
const $ = cheerio.load(html);
- expect($('#default')).to.have.lengthOf(1);
+ assert.equal($('#default').length, 1);
});
it('Slots override fallback content', async () => {
const html = await fixture.readFile('/fallback-override/index.html');
const $ = cheerio.load(html);
- expect($('#override')).to.have.lengthOf(1);
- expect($('#fallback-2').text()).to.equal('Slotty slot.');
+ assert.equal($('#override').length, 1);
+ assert.equal($('#fallback-2').text(), 'Slotty slot.');
});
it('Slots work with multiple elements', async () => {
const html = await fixture.readFile('/multiple/index.html');
const $ = cheerio.load(html);
- expect($('#a').text().trim()).to.equal('ABC');
+ assert.equal($('#a').text().trim(), 'ABC');
});
it('Slots work on Components', async () => {
@@ -74,13 +75,12 @@ describe('Slots', () => {
const $ = cheerio.load(html);
// test 1: #a renders
- expect($('#a')).to.have.lengthOf(1);
+ assert.equal($('#a').length, 1);
// test 2: Slotted component into #a
- expect($('#a').children('astro-component')).to.have.lengthOf(1);
-
+ assert.equal($('#a').children('astro-component').length, 1);
// test 3: Slotted component into default slot
- expect($('#default').children('astro-component')).to.have.lengthOf(1);
+ assert.equal($('#default').children('astro-component').length, 1);
});
describe('Slots API work on Components', () => {
@@ -88,42 +88,42 @@ describe('Slots', () => {
const html = await fixture.readFile('/slottedapi-default/index.html');
const $ = cheerio.load(html);
- expect($('#a')).to.have.lengthOf(1);
- expect($('#b')).to.have.lengthOf(1);
- expect($('#c')).to.have.lengthOf(1);
- expect($('#default')).to.have.lengthOf(1);
+ assert.equal($('#a').length, 1);
+ assert.equal($('#b').length, 1);
+ assert.equal($('#c').length, 1);
+ assert.equal($('#default').length, 1);
});
it('IDs will not exist because the slots are not filled', async () => {
const html = await fixture.readFile('/slottedapi-empty/index.html');
const $ = cheerio.load(html);
- expect($('#a')).to.have.lengthOf(0);
- expect($('#b')).to.have.lengthOf(0);
- expect($('#c')).to.have.lengthOf(0);
- expect($('#default')).to.have.lengthOf(0);
+ assert.equal($('#a').length, 0);
+ assert.equal($('#b').length, 0);
+ assert.equal($('#c').length, 0);
+ assert.equal($('#default').length, 0);
});
it('IDs will exist because the slots are filled', async () => {
const html = await fixture.readFile('/slottedapi-filled/index.html');
const $ = cheerio.load(html);
- expect($('#a')).to.have.lengthOf(1);
- expect($('#b')).to.have.lengthOf(1);
- expect($('#c')).to.have.lengthOf(1);
+ assert.equal($('#a').length, 1);
+ assert.equal($('#b').length, 1);
+ assert.equal($('#c').length, 1);
- expect($('#default')).to.have.lengthOf(0); // the default slot is not filled
+ assert.equal($('#default').length, 0); // the default slot is not filled
});
it('Default ID will exist because the default slot is filled', async () => {
const html = await fixture.readFile('/slottedapi-default-filled/index.html');
const $ = cheerio.load(html);
- expect($('#a')).to.have.lengthOf(0);
- expect($('#b')).to.have.lengthOf(0);
- expect($('#c')).to.have.lengthOf(0);
+ assert.equal($('#a').length, 0);
+ assert.equal($('#b').length, 0);
+ assert.equal($('#c').length, 0);
- expect($('#default')).to.have.lengthOf(1); // the default slot is filled
+ assert.equal($('#default').length, 1); // the default slot is not filled
});
});
@@ -133,8 +133,8 @@ describe('Slots', () => {
const html = await fixture.readFile('/slottedapi-render/index.html');
const $ = cheerio.load(html);
- expect($('#render')).to.have.lengthOf(1);
- expect($('#render').text()).to.equal('render');
+ assert.equal($('#render').length, 1);
+ assert.equal($('#render').text(), 'render');
}
// Child function render without args
@@ -142,8 +142,8 @@ describe('Slots', () => {
const html = await fixture.readFile('/slottedapi-render/index.html');
const $ = cheerio.load(html);
- expect($('#render-fn')).to.have.lengthOf(1);
- expect($('#render-fn').text()).to.equal('render-fn');
+ assert.equal($('#render-fn').length, 1);
+ assert.equal($('#render-fn').text(), 'render-fn');
}
// Child function render with args
@@ -151,9 +151,9 @@ describe('Slots', () => {
const html = await fixture.readFile('/slottedapi-render/index.html');
const $ = cheerio.load(html);
- expect($('#render-args')).to.have.lengthOf(1);
- expect($('#render-args span')).to.have.lengthOf(1);
- expect($('#render-args').text()).to.equal('render-args');
+ assert.equal($('#render-args').length, 1);
+ assert.equal($('#render-args span').length, 1);
+ assert.equal($('#render-args').text(), 'render-args');
}
{
@@ -161,13 +161,13 @@ describe('Slots', () => {
const $ = cheerio.load(html);
const elements = $('div');
- expect(elements).to.have.lengthOf(10);
+ assert.equal(elements.length, 10);
const [first, second, third] = elements;
- expect(first.children[0].data).to.not.equal(second.children[0].data);
- expect(second.children[0].data).to.not.equal(third.children[0].data);
- expect(third.children[0].data).to.not.equal(first.children[0].data);
+ assert.notEqual(first.children[0].data, second.children[0].data);
+ assert.notEqual(second.children[0].data, third.children[0].data);
+ assert.notEqual(third.children[0].data, first.children[0].data);
}
});
});
diff --git a/packages/astro/test/before-hydration.test.js b/packages/astro/test/before-hydration.nodetest.js
similarity index 88%
rename from packages/astro/test/before-hydration.test.js
rename to packages/astro/test/before-hydration.nodetest.js
index f429c31b35..76d824a750 100644
--- a/packages/astro/test/before-hydration.test.js
+++ b/packages/astro/test/before-hydration.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { after, describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import { preact } from './fixtures/before-hydration/deps.mjs';
@@ -43,7 +44,7 @@ describe('Astro Scripts before-hydration', () => {
let res = await fixture.fetch('/');
let html = await res.text();
let $ = cheerio.load(html);
- expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
+ assert.equal($('astro-island[before-hydration-url]').length, 1);
});
});
@@ -55,7 +56,7 @@ describe('Astro Scripts before-hydration', () => {
it('Is included in the astro-island', async () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
- expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
+ assert.equal($('astro-island[before-hydration-url]').length, 1);
});
});
});
@@ -86,7 +87,7 @@ describe('Astro Scripts before-hydration', () => {
let res = await fixture.fetch('/');
let html = await res.text();
let $ = cheerio.load(html);
- expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
+ assert.equal($('astro-island[before-hydration-url]').length, 1);
});
});
@@ -98,7 +99,7 @@ describe('Astro Scripts before-hydration', () => {
it('Does not include before-hydration-url on the astro-island', async () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
- expect($('astro-island[before-hydration-url]')).has.a.lengthOf(0);
+ assert.equal($('astro-island[before-hydration-url]').length, 0);
});
});
});
@@ -139,7 +140,7 @@ describe('Astro Scripts before-hydration', () => {
let response = await app.render(request);
let html = await response.text();
let $ = cheerio.load(html);
- expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
+ assert.equal($('astro-island[before-hydration-url]').length, 1);
});
});
});
@@ -167,7 +168,7 @@ describe('Astro Scripts before-hydration', () => {
let response = await app.render(request);
let html = await response.text();
let $ = cheerio.load(html);
- expect($('astro-island[before-hydration-url]')).has.a.lengthOf(0);
+ assert.equal($('astro-island[before-hydration-url]').length, 0);
});
});
});
diff --git a/packages/astro/test/build-assets.test.js b/packages/astro/test/build-assets.nodetest.js
similarity index 74%
rename from packages/astro/test/build-assets.test.js
rename to packages/astro/test/build-assets.nodetest.js
index 3d4dacd7b5..cba3e5b46a 100644
--- a/packages/astro/test/build-assets.test.js
+++ b/packages/astro/test/build-assets.nodetest.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import assert from 'node:assert/strict';
+import { describe, before, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import { preact } from './fixtures/before-hydration/deps.mjs';
@@ -21,13 +22,13 @@ describe('build assets (static)', () => {
it('Populates /_astro directory', async () => {
let files = await fixture.readdir('/_astro');
- expect(files.length).to.be.greaterThan(0);
+ assert.equal(files.length > 0, true);
});
it('Defaults to flat /_astro output', async () => {
let files = await fixture.readdir('/_astro');
for (const file of files) {
- expect(file.slice(1)).to.not.contain('/');
+ assert.equal(file.slice(1).includes('/'), false);
}
});
@@ -35,7 +36,7 @@ describe('build assets (static)', () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
- expect($('link[href$=".css"]').attr('href')).to.match(/^\/_astro\//);
+ assert.match($('link[href$=".css"]').attr('href'), /^\/_astro\//);
});
it('emits JS assets to /_astro', async () => {
@@ -43,9 +44,9 @@ describe('build assets (static)', () => {
let $ = cheerio.load(html);
const island = $('astro-island');
- expect(island.length).to.eq(1);
- expect(island.attr('component-url')).to.match(/^\/_astro\//);
- expect(island.attr('renderer-url')).to.match(/^\/_astro\//);
+ assert.equal(island.length, 1);
+ assert.match(island.attr('component-url'), /^\/_astro\//);
+ assert.match(island.attr('renderer-url'), /^\/_astro\//);
});
});
@@ -67,14 +68,14 @@ describe('build assets (static)', () => {
it('Populates /custom-assets directory', async () => {
let files = await fixture.readdir('/custom-assets');
- expect(files.length).to.be.greaterThan(0);
+ assert.equal(files.length > 0, true);
});
it('emits CSS assets to /custom-assets', async () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
- expect($('link[href$=".css"]').attr('href')).to.match(/^\/custom-assets\//);
+ assert.match($('link[href$=".css"]').attr('href'), /^\/custom-assets\//);
});
it('emits JS assets to /custom-assets', async () => {
@@ -82,9 +83,9 @@ describe('build assets (static)', () => {
let $ = cheerio.load(html);
const island = $('astro-island');
- expect(island.length).to.eq(1);
- expect(island.attr('component-url')).to.match(/^\/custom-assets\//);
- expect(island.attr('renderer-url')).to.match(/^\/custom-assets\//);
+ assert.equal(island.length, 1);
+ assert.match(island.attr('component-url'), /^\/custom-assets\//);
+ assert.match(island.attr('renderer-url'), /^\/custom-assets\//);
});
});
});
@@ -107,13 +108,13 @@ describe('build assets (server)', () => {
it('Populates /_astro directory', async () => {
let files = await fixture.readdir('/_astro');
- expect(files.length).to.be.greaterThan(0);
+ assert.equal(files.length > 0, true);
});
it('Defaults to flat /_astro output', async () => {
let files = await fixture.readdir('/_astro');
for (const file of files) {
- expect(file.slice(1)).to.not.contain('/');
+ assert.equal(file.slice(1).includes('/'), false);
}
});
@@ -121,7 +122,7 @@ describe('build assets (server)', () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
- expect($('link[href$=".css"]').attr('href')).to.match(/^\/_astro\//);
+ assert.match($('link[href$=".css"]').attr('href'), /^\/_astro\//);
});
it('emits JS assets to /_astro', async () => {
@@ -129,9 +130,9 @@ describe('build assets (server)', () => {
let $ = cheerio.load(html);
const island = $('astro-island');
- expect(island.length).to.eq(1);
- expect(island.attr('component-url')).to.match(/^\/_astro\//);
- expect(island.attr('renderer-url')).to.match(/^\/_astro\//);
+ assert.equal(island.length, 1);
+ assert.match(island.attr('component-url'), /^\/_astro\//);
+ assert.match(island.attr('renderer-url'), /^\/_astro\//);
});
});
@@ -154,14 +155,14 @@ describe('build assets (server)', () => {
it('Populates /custom-assets directory', async () => {
let files = await fixture.readdir('/custom-assets');
- expect(files.length).to.be.greaterThan(0);
+ assert.equal(files.length > 0, true);
});
it('emits CSS assets to /custom-assets', async () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
- expect($('link[href$=".css"]').attr('href')).to.match(/^\/custom-assets\//);
+ assert.match($('link[href$=".css"]').attr('href'), /^\/custom-assets\//);
});
it('emits JS assets to /custom-assets', async () => {
@@ -169,9 +170,9 @@ describe('build assets (server)', () => {
let $ = cheerio.load(html);
const island = $('astro-island');
- expect(island.length).to.eq(1);
- expect(island.attr('component-url')).to.match(/^\/custom-assets\//);
- expect(island.attr('renderer-url')).to.match(/^\/custom-assets\//);
+ assert.equal(island.length, 1);
+ assert.match(island.attr('component-url'), /^\/custom-assets\//);
+ assert.match(island.attr('renderer-url'), /^\/custom-assets\//);
});
});
});