summaryrefslogtreecommitdiff
path: root/packages/upgrade/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/upgrade/test')
-rw-r--r--packages/upgrade/test/context.test.js13
-rw-r--r--packages/upgrade/test/install.test.js57
-rw-r--r--packages/upgrade/test/utils.js1
-rw-r--r--packages/upgrade/test/verify.test.js23
4 files changed, 49 insertions, 45 deletions
diff --git a/packages/upgrade/test/context.test.js b/packages/upgrade/test/context.test.js
index 5b6b8c6b2..714a7b64a 100644
--- a/packages/upgrade/test/context.test.js
+++ b/packages/upgrade/test/context.test.js
@@ -1,19 +1,20 @@
-import { expect } from 'chai';
+import { describe, it } from 'node:test';
+import * as assert from 'node:assert/strict';
import { getContext } from '../dist/index.js';
describe('context', () => {
it('no arguments', async () => {
const ctx = await getContext([]);
- expect(ctx.version).to.eq('latest');
- expect(ctx.dryRun).to.be.undefined;
+ assert.equal(ctx.version, 'latest');
+ assert.equal(ctx.dryRun, undefined);
});
it('tag', async () => {
const ctx = await getContext(['beta']);
- expect(ctx.version).to.eq('beta');
- expect(ctx.dryRun).to.be.undefined;
+ assert.equal(ctx.version, 'beta');
+ assert.equal(ctx.dryRun, undefined);
});
it('dry run', async () => {
const ctx = await getContext(['--dry-run']);
- expect(ctx.dryRun).to.eq(true);
+ assert.equal(ctx.dryRun, true);
});
});
diff --git a/packages/upgrade/test/install.test.js b/packages/upgrade/test/install.test.js
index 05c46cdce..b4158d264 100644
--- a/packages/upgrade/test/install.test.js
+++ b/packages/upgrade/test/install.test.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import { describe, it } from 'node:test';
+import * as assert from 'node:assert/strict';
import { setup } from './utils.js';
import { install } from '../dist/index.js';
@@ -23,7 +24,7 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('◼ astro is up to date on v1.0.0')).to.be.true;
+ assert.equal(fixture.hasMessage('◼ astro is up to date on v1.0.0'), true);
});
it('patch', async () => {
@@ -38,7 +39,7 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('● astro can be updated to v1.0.1')).to.be.true;
+ assert.equal(fixture.hasMessage('● astro can be updated to v1.0.1'), true);
});
it('minor', async () => {
@@ -53,7 +54,7 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('● astro can be updated to v1.2.0')).to.be.true;
+ assert.equal(fixture.hasMessage('● astro can be updated to v1.2.0'), true);
});
it('major (reject)', async () => {
@@ -80,10 +81,10 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('▲ astro can be updated to v2.0.0')).to.be.true;
- expect(prompted).to.be.true;
- expect(exitCode).to.eq(0);
- expect(fixture.hasMessage('check Be sure to follow the CHANGELOG.')).to.be.false;
+ assert.equal(fixture.hasMessage('▲ astro can be updated to v2.0.0'), true);
+ assert.equal(prompted, true);
+ assert.equal(exitCode, 0);
+ assert.equal(fixture.hasMessage('check Be sure to follow the CHANGELOG.'), false);
});
it('major (accept)', async () => {
@@ -110,10 +111,10 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('▲ astro can be updated to v2.0.0')).to.be.true;
- expect(prompted).to.be.true;
- expect(exitCode).to.be.undefined;
- expect(fixture.hasMessage('check Be sure to follow the CHANGELOG.')).to.be.true;
+ assert.equal(fixture.hasMessage('▲ astro can be updated to v2.0.0'), true);
+ assert.equal(prompted, true);
+ assert.equal(exitCode, undefined);
+ assert.equal(fixture.hasMessage('check Be sure to follow the CHANGELOG.'), true);
});
it('multiple major', async () => {
@@ -148,14 +149,14 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('▲ a can be updated to v2.0.0')).to.be.true;
- expect(fixture.hasMessage('▲ b can be updated to v7.0.0')).to.be.true;
- expect(prompted).to.be.true;
- expect(exitCode).to.be.undefined;
+ assert.equal(fixture.hasMessage('▲ a can be updated to v2.0.0'), true);
+ assert.equal(fixture.hasMessage('▲ b can be updated to v7.0.0'), true);
+ assert.equal(prompted, true);
+ assert.equal(exitCode, undefined);
const [changelog, a, b] = fixture.messages().slice(-5);
- expect(changelog).to.match(/^check/);
- expect(a).to.match(/^a/);
- expect(b).to.match(/^b/);
+ assert.match(changelog, /^check/);
+ assert.match(a, /^a/);
+ assert.match(b, /^b/);
});
it('current patch minor major', async () => {
@@ -197,15 +198,15 @@ describe('install', () => {
],
};
await install(context);
- expect(fixture.hasMessage('◼ current is up to date on v1.0.0')).to.be.true;
- expect(fixture.hasMessage('● patch can be updated to v1.0.1')).to.be.true;
- expect(fixture.hasMessage('● minor can be updated to v1.2.0')).to.be.true;
- expect(fixture.hasMessage('▲ major can be updated to v3.0.0')).to.be.true;
- expect(prompted).to.be.true;
- expect(exitCode).to.be.undefined;
- expect(fixture.hasMessage('check Be sure to follow the CHANGELOG.')).to.be.true;
+ assert.equal(fixture.hasMessage('◼ current is up to date on v1.0.0'), true);
+ assert.equal(fixture.hasMessage('● patch can be updated to v1.0.1'), true);
+ assert.equal(fixture.hasMessage('● minor can be updated to v1.2.0'), true);
+ assert.equal(fixture.hasMessage('▲ major can be updated to v3.0.0'), true);
+ assert.equal(prompted, true);
+ assert.equal(exitCode, undefined);
+ assert.equal(fixture.hasMessage('check Be sure to follow the CHANGELOG.'), true);
const [changelog, major] = fixture.messages().slice(-4);
- expect(changelog).to.match(/^check/);
- expect(major).to.match(/^major/);
+ assert.match(changelog, /^check/);
+ assert.match(major, /^major/)
});
});
diff --git a/packages/upgrade/test/utils.js b/packages/upgrade/test/utils.js
index ff5d5dd83..691e63d90 100644
--- a/packages/upgrade/test/utils.js
+++ b/packages/upgrade/test/utils.js
@@ -1,3 +1,4 @@
+import { before, beforeEach } from 'node:test';
import { setStdout } from '../dist/index.js';
import stripAnsi from 'strip-ansi';
diff --git a/packages/upgrade/test/verify.test.js b/packages/upgrade/test/verify.test.js
index a54cb6bb5..3b9d4b3bc 100644
--- a/packages/upgrade/test/verify.test.js
+++ b/packages/upgrade/test/verify.test.js
@@ -1,4 +1,5 @@
-import { expect } from 'chai';
+import { describe, it, beforeEach } from 'node:test';
+import * as assert from 'node:assert/strict';
import { collectPackageInfo } from '../dist/index.js';
describe('collectPackageInfo', () => {
@@ -16,61 +17,61 @@ describe('collectPackageInfo', () => {
it('detects astro', async () => {
collectPackageInfo(context, { astro: '1.0.0' }, {});
- expect(context.packages).deep.equal([
+ assert.deepEqual(context.packages, [
{ name: 'astro', currentVersion: '1.0.0', targetVersion: 'latest' },
]);
});
it('detects @astrojs', async () => {
collectPackageInfo(context, { '@astrojs/preact': '1.0.0' }, {});
- expect(context.packages).deep.equal([
+ assert.deepEqual(context.packages, [
{ name: '@astrojs/preact', currentVersion: '1.0.0', targetVersion: 'latest' },
]);
});
it('supports ^ prefixes', async () => {
collectPackageInfo(context, { astro: '^1.0.0' }, {});
- expect(context.packages).deep.equal([
+ assert.deepEqual(context.packages, [
{ name: 'astro', currentVersion: '^1.0.0', targetVersion: 'latest' },
]);
});
it('supports ~ prefixes', async () => {
collectPackageInfo(context, { astro: '~1.0.0' }, {});
- expect(context.packages).deep.equal([
+ assert.deepEqual(context.packages, [
{ name: 'astro', currentVersion: '~1.0.0', targetVersion: 'latest' },
]);
});
it('supports prereleases', async () => {
collectPackageInfo(context, { astro: '1.0.0-beta.0' }, {});
- expect(context.packages).deep.equal([
+ assert.deepEqual(context.packages, [
{ name: 'astro', currentVersion: '1.0.0-beta.0', targetVersion: 'latest' },
]);
});
it('ignores self', async () => {
collectPackageInfo(context, { '@astrojs/upgrade': '0.0.1' }, {});
- expect(context.packages).deep.equal([]);
+ assert.deepEqual(context.packages, []);
});
it('ignores linked packages', async () => {
collectPackageInfo(context, { '@astrojs/preact': 'link:../packages/preact' }, {});
- expect(context.packages).deep.equal([]);
+ assert.deepEqual(context.packages, []);
});
it('ignores workspace packages', async () => {
collectPackageInfo(context, { '@astrojs/preact': 'workspace:*' }, {});
- expect(context.packages).deep.equal([]);
+ assert.deepEqual(context.packages, []);
});
it('ignores github packages', async () => {
collectPackageInfo(context, { '@astrojs/preact': 'github:withastro/astro' }, {});
- expect(context.packages).deep.equal([]);
+ assert.deepEqual(context.packages, []);
});
it('ignores tag', async () => {
collectPackageInfo(context, { '@astrojs/preact': 'beta' }, {});
- expect(context.packages).deep.equal([]);
+ assert.deepEqual(context.packages, []);
});
});