0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/create-astro/test/verify.test.js
Shoaib Khan 3007d24c98
chore: Migrate all packages/create-astro/test to node:test (#10084)
* chore: Migrate All packages/create-astro/test to node:test

* Some minor fix

* Requested Changes done

* Reopen

* Apply suggestions from code review

* let's test with concurrency

* chore: fix possible false positive tests

* todo test

* skip tests

* Apply suggestions from code review

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2024-02-13 14:41:59 +00:00

41 lines
1.1 KiB
JavaScript

import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { setup } from './utils.js';
import { verify } from '../dist/index.js';
describe('verify', async () => {
const fixture = setup();
const exit = (code) => {
throw code;
};
it('basics', async () => {
const context = { template: 'basics', exit };
await verify(context);
assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
});
it('missing', async () => {
const context = { template: 'missing', exit };
let err = null;
try {
await verify(context);
} catch (e) {
err = e;
}
assert.equal(err, 1);
assert.ok(!fixture.hasMessage('Template missing does not exist!'));
});
it('starlight', async () => {
const context = { template: 'starlight', exit };
await verify(context);
assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
});
it('starlight/tailwind', async () => {
const context = { template: 'starlight/tailwind', exit };
await verify(context);
assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
});
});