diff options
-rw-r--r-- | packages/astro/test/alias-tsconfig-baseurl-only.nodetest.js (renamed from packages/astro/test/alias-tsconfig-baseurl-only.test.js) | 35 | ||||
-rw-r--r-- | packages/astro/test/alias-tsconfig.nodetest.js (renamed from packages/astro/test/alias-tsconfig.test.js) | 43 | ||||
-rw-r--r-- | packages/astro/test/alias.nodetest.js (renamed from packages/astro/test/alias.test.js) | 15 |
3 files changed, 48 insertions, 45 deletions
diff --git a/packages/astro/test/alias-tsconfig-baseurl-only.test.js b/packages/astro/test/alias-tsconfig-baseurl-only.nodetest.js index 64c196808..4d7e27fce 100644 --- a/packages/astro/test/alias-tsconfig-baseurl-only.test.js +++ b/packages/astro/test/alias-tsconfig-baseurl-only.nodetest.js @@ -1,4 +1,5 @@ -import { expect } from 'chai'; +import assert from 'node:assert/strict'; +import { describe, before, it, after } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; @@ -51,33 +52,33 @@ describe('Aliases with tsconfig.json - baseUrl only', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test') const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0) }); it('can load via baseUrl', async () => { const html = await fixture.fetch('/').then((res) => res.text()); const $ = cheerio.load(html); - expect($('#foo').text()).to.equal('foo'); - expect($('#constants-foo').text()).to.equal('foo'); - expect($('#constants-index').text()).to.equal('index'); + assert.equal($('#foo').text(), 'foo'); + assert.equal($('#constants-foo').text(), 'foo'); + assert.equal($('#constants-index').text(), 'index'); }); it('works in css @import', async () => { const html = await fixture.fetch('/').then((res) => res.text()); // imported css should be bundled - expect(html).to.include('#style-red'); - expect(html).to.include('#style-blue'); + assert.ok(html.includes('#style-red')); + assert.ok(html.includes('#style-blue')); }); it('works in components', async () => { const html = await fixture.fetch('/').then((res) => res.text()); const $ = cheerio.load(html); - expect($('#alias').text()).to.equal('foo'); + assert.equal($('#alias').text(), 'foo') }); }); @@ -91,19 +92,19 @@ describe('Aliases with tsconfig.json - baseUrl only', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test') const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0) }); it('can load via baseUrl', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); - expect($('#foo').text()).to.equal('foo'); - expect($('#constants-foo').text()).to.equal('foo'); - expect($('#constants-index').text()).to.equal('index'); + assert.equal($('#foo').text(), 'foo'); + assert.equal($('#constants-foo').text(), 'foo'); + assert.equal($('#constants-index').text(), 'index'); }); it('works in css @import', async () => { @@ -111,15 +112,15 @@ describe('Aliases with tsconfig.json - baseUrl only', () => { const content = await Promise.all(getLinks(html).map((href) => getLinkContent(href))); const [{ css }] = content; // imported css should be bundled - expect(css).to.include('#style-red'); - expect(css).to.include('#style-blue'); + assert.ok(css.includes('#style-red')); + assert.ok(css.includes('#style-blue')); }); it('works in components', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); - expect($('#alias').text()).to.equal('foo'); + assert.equal($('#alias').text(), 'foo') }); }); }); diff --git a/packages/astro/test/alias-tsconfig.test.js b/packages/astro/test/alias-tsconfig.nodetest.js index 2342e94a3..006e12705 100644 --- a/packages/astro/test/alias-tsconfig.test.js +++ b/packages/astro/test/alias-tsconfig.nodetest.js @@ -1,4 +1,5 @@ -import { expect } from 'chai'; +import assert from 'node:assert/strict'; +import { describe, before, it, after } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; @@ -51,47 +52,47 @@ describe('Aliases with tsconfig.json', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test'); const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0); }); it('can load via baseUrl', async () => { const html = await fixture.fetch('/').then((res) => res.text()); const $ = cheerio.load(html); - expect($('#foo').text()).to.equal('foo'); - expect($('#constants-foo').text()).to.equal('foo'); - expect($('#constants-index').text()).to.equal('index'); + assert.equal($('#foo').text(), 'foo'); + assert.equal($('#constants-foo').text(), 'foo'); + assert.equal($('#constants-index').text(), 'index'); }); it('can load namespace packages with @* paths', async () => { const html = await fixture.fetch('/').then((res) => res.text()); const $ = cheerio.load(html); - expect($('#namespace').text()).to.equal('namespace'); + assert.equal($('#namespace').text(), 'namespace'); }); it('works in css @import', async () => { const html = await fixture.fetch('/').then((res) => res.text()); // imported css should be bundled - expect(html).to.include('#style-red'); - expect(html).to.include('#style-blue'); + assert.ok(html.includes('#style-red')); + assert.ok(html.includes('#style-blue')); }); it('works in components', async () => { const html = await fixture.fetch('/').then((res) => res.text()); const $ = cheerio.load(html); - expect($('#alias').text()).to.equal('foo'); + assert.equal($('#alias').text(), 'foo'); }); it('works for import.meta.glob', async () => { const html = await fixture.fetch('/').then((res) => res.text()); const $ = cheerio.load(html); - expect($('#glob').text()).to.equal('/src/components/glob/a.js'); + assert.equal($('#glob').text(), '/src/components/glob/a.js'); }); }); @@ -105,26 +106,26 @@ describe('Aliases with tsconfig.json', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test'); const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0); }); it('can load via baseUrl', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); - expect($('#foo').text()).to.equal('foo'); - expect($('#constants-foo').text()).to.equal('foo'); - expect($('#constants-index').text()).to.equal('index'); + assert.equal($('#foo').text(), 'foo'); + assert.equal($('#constants-foo').text(), 'foo'); + assert.equal($('#constants-index').text(), 'index'); }); it('can load namespace packages with @* paths', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); - expect($('#namespace').text()).to.equal('namespace'); + assert.equal($('#namespace').text(), 'namespace'); }); it('works in css @import', async () => { @@ -132,22 +133,22 @@ describe('Aliases with tsconfig.json', () => { const content = await Promise.all(getLinks(html).map((href) => getLinkContent(href))); const [{ css }] = content; // imported css should be bundled - expect(css).to.include('#style-red'); - expect(css).to.include('#style-blue'); + assert.ok(css.includes('#style-red')); + assert.ok(css.includes('#style-blue')); }); it('works in components', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); - expect($('#alias').text()).to.equal('foo'); + assert.equal($('#alias').text(), 'foo'); }); it('works for import.meta.glob', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); - expect($('#glob').text()).to.equal('/src/components/glob/a.js'); + assert.equal($('#glob').text(), '/src/components/glob/a.js'); }); }); }); diff --git a/packages/astro/test/alias.test.js b/packages/astro/test/alias.nodetest.js index 109d600ca..e9f4ab638 100644 --- a/packages/astro/test/alias.test.js +++ b/packages/astro/test/alias.nodetest.js @@ -1,4 +1,5 @@ -import { expect } from 'chai'; +import assert from 'node:assert/strict'; +import { describe, before, it, after } from 'node:test'; import * as cheerio from 'cheerio'; import { isWindows, loadFixture } from './test-utils.js'; @@ -29,10 +30,10 @@ describe('Aliases', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test'); const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0); }); }); @@ -46,10 +47,10 @@ describe('Aliases', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test'); const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0); }); it('can use aliases and relative in same project', async () => { @@ -57,10 +58,10 @@ describe('Aliases', () => { const $ = cheerio.load(html); // Should render aliased element - expect($('#client').text()).to.equal('test'); + assert.equal($('#client').text(), 'test'); const scripts = $('script').toArray(); - expect(scripts.length).to.be.greaterThan(0); + assert.ok(scripts.length > 0); }); }); }); |