summaryrefslogtreecommitdiff
path: root/packages/create-astro/test/context.test.js
diff options
context:
space:
mode:
authorGravatar Shoaib Khan <56039103+shoaibkh4n@users.noreply.github.com> 2024-02-13 20:11:59 +0530
committerGravatar GitHub <noreply@github.com> 2024-02-13 14:41:59 +0000
commit3007d24c98e607442903a3c0aaaea195390a25e7 (patch)
tree8a993608a3d35b47c8c5e016cc45359f4578af64 /packages/create-astro/test/context.test.js
parentbd877d389a6ebdd995e253bcb9daccef52b2277f (diff)
downloadastro-3007d24c98e607442903a3c0aaaea195390a25e7.tar.gz
astro-3007d24c98e607442903a3c0aaaea195390a25e7.tar.zst
astro-3007d24c98e607442903a3c0aaaea195390a25e7.zip
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>
Diffstat (limited to 'packages/create-astro/test/context.test.js')
-rw-r--r--packages/create-astro/test/context.test.js49
1 files changed, 30 insertions, 19 deletions
diff --git a/packages/create-astro/test/context.test.js b/packages/create-astro/test/context.test.js
index 113417417..654733e6c 100644
--- a/packages/create-astro/test/context.test.js
+++ b/packages/create-astro/test/context.test.js
@@ -1,62 +1,73 @@
-import { expect } from 'chai';
-
+import assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
import os from 'node:os';
import { getContext } from '../dist/index.js';
-
describe('context', () => {
it('no arguments', async () => {
const ctx = await getContext([]);
- expect(ctx.projectName).to.be.undefined;
- expect(ctx.template).to.be.undefined;
- expect(ctx.skipHouston).to.eq(os.platform() === 'win32');
- expect(ctx.dryRun).to.be.undefined;
+ assert.ok(!ctx.projectName);
+ assert.ok(!ctx.template);
+ assert.deepStrictEqual(ctx.skipHouston, os.platform() === 'win32');
+ assert.ok(!ctx.dryRun);
});
+
it('project name', async () => {
const ctx = await getContext(['foobar']);
- expect(ctx.projectName).to.eq('foobar');
+ assert.deepStrictEqual(ctx.projectName, 'foobar');
});
+
it('template', async () => {
const ctx = await getContext(['--template', 'minimal']);
- expect(ctx.template).to.eq('minimal');
+ assert.deepStrictEqual(ctx.template, 'minimal');
});
+
it('skip houston (explicit)', async () => {
const ctx = await getContext(['--skip-houston']);
- expect(ctx.skipHouston).to.eq(true);
+ assert.deepStrictEqual(ctx.skipHouston, true);
});
+
it('skip houston (yes)', async () => {
const ctx = await getContext(['-y']);
- expect(ctx.skipHouston).to.eq(true);
+ assert.deepStrictEqual(ctx.skipHouston, true);
});
+
it('skip houston (no)', async () => {
const ctx = await getContext(['-n']);
- expect(ctx.skipHouston).to.eq(true);
+ assert.deepStrictEqual(ctx.skipHouston, true);
});
+
it('skip houston (install)', async () => {
const ctx = await getContext(['--install']);
- expect(ctx.skipHouston).to.eq(true);
+ assert.deepStrictEqual(ctx.skipHouston, true);
});
+
it('dry run', async () => {
const ctx = await getContext(['--dry-run']);
- expect(ctx.dryRun).to.eq(true);
+ assert.deepStrictEqual(ctx.dryRun, true);
});
+
it('install', async () => {
const ctx = await getContext(['--install']);
- expect(ctx.install).to.eq(true);
+ assert.deepStrictEqual(ctx.install, true);
});
+
it('no install', async () => {
const ctx = await getContext(['--no-install']);
- expect(ctx.install).to.eq(false);
+ assert.deepStrictEqual(ctx.install, false);
});
+
it('git', async () => {
const ctx = await getContext(['--git']);
- expect(ctx.git).to.eq(true);
+ assert.deepStrictEqual(ctx.git, true);
});
+
it('no git', async () => {
const ctx = await getContext(['--no-git']);
- expect(ctx.git).to.eq(false);
+ assert.deepStrictEqual(ctx.git, false);
});
+
it('typescript', async () => {
const ctx = await getContext(['--typescript', 'strict']);
- expect(ctx.typescript).to.eq('strict');
+ assert.deepStrictEqual(ctx.typescript, 'strict');
});
});