Skip to content

Commit f3c5174

Browse files
authored
feat: migrate to esm (#717)
1 parent a1c754b commit f3c5174

35 files changed

+4294
-2853
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup pnpm
3030
uses: pnpm/action-setup@v2
3131
with:
32-
version: 8
32+
version: 9
3333

3434
- name: Use Node.js ${{ matrix.node-version }}
3535
uses: actions/setup-node@v4
@@ -41,7 +41,7 @@ jobs:
4141
run: pnpm install
4242

4343
- name: Run unit test
44-
run: pnpm test:ci
44+
run: pnpm test
4545

4646
e2e-tests:
4747
name: end-to-end

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Mumble.proto
2-
jest.config.ts
2+
vitest.config.ts
33
renovate.json
44

55
# Logs

e2e.jest.config.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

e2e/creates-and-removes-channels.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Channel, Client } from '@';
1+
import { Channel, Client } from '../src';
22
import { readFile } from 'fs/promises';
33
import { join } from 'path';
44
import { waitABit } from './utils/wait-a-bit';

e2e/handles-server-disconnects.e2e-spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { waitABit } from './utils/wait-a-bit';
33

4-
jest.setTimeout(60 * 1000);
5-
64
describe('Handles server disconnects (e2e)', () => {
75
let client1: Client;
86
let client2: Client;
@@ -32,7 +30,7 @@ describe('Handles server disconnects (e2e)', () => {
3230
client2.disconnect();
3331
});
3432

35-
it('should handle error', async () => {
33+
it('should handle error', { timeout: 60 * 1000 }, async () => {
3634
let wasDisconnected = false;
3735
client1.on('disconnect', () => (wasDisconnected = true));
3836

e2e/joins-channel.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { waitABit } from './utils/wait-a-bit';
33

44
describe('Joins a channel (e2e)', () => {

e2e/links-unlinks-channels.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { readFile } from 'fs/promises';
33
import { join } from 'path';
44
import { waitABit } from './utils/wait-a-bit';

e2e/list-channels.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { waitABit } from './utils/wait-a-bit';
33

44
describe('List channels (e2e)', () => {

e2e/logs-in-registered.e2e-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Client } from '@';
2-
import { ConnectionRejectedError } from '@/errors';
1+
import { Client } from '../src';
2+
import { ConnectionRejectedError } from '../src/errors';
33
import { readFile } from 'fs/promises';
44
import { join } from 'path';
55
import { waitABit } from './utils/wait-a-bit';

e2e/mumble-data/mumble_server_config.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Config file automatically generated from the MUMBLE_CONFIG_* environment variables
2+
# or secrets in /run/secrets/MUMBLE_CONFIG_* files
23

4+
autobanAttempts=0
35
database=/data/murmur.sqlite
46
ice="tcp -h 127.0.0.1 -p 6502"
57
welcometext="<br />Welcome to this server, running the official Mumble Docker image.<br />Enjoy your stay!<br />"

e2e/mumble-data/murmur.sqlite

8 KB
Binary file not shown.

e2e/rejects-creating-channel.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { waitABit } from './utils/wait-a-bit';
33

44
describe('Rejects creating channel when there are insufficient permissions (e2e)', () => {

e2e/rejects-joining-channel.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { waitABit } from './utils/wait-a-bit';
33

44
describe('Rejects moving to a channel when there are insufficient permissions (e2e)', () => {

e2e/rejects-removing-channel.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from '@';
1+
import { Client } from '../src';
22
import { waitABit } from './utils/wait-a-bit';
33

44
describe('Rejects removing channel when there are insufficient permissions (e2e)', () => {

e2e/self-deafens.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
import { Client } from '@';
2+
import { Client } from '../src';
33
import { waitABit } from './utils/wait-a-bit';
44

55
describe('Sets self-deaf (e2e)', () => {

e2e/self-mutes.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
import { Client } from '@';
2+
import { Client } from '../src';
33
import { waitABit } from './utils/wait-a-bit';
44

55
describe('Sets self-mute (e2e)', () => {

e2e/vitest.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
globals: true,
6+
include: ['**/*.e2e-spec.ts'],
7+
fileParallelism: false,
8+
},
9+
});

jest.config.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.7.3",
44
"description": "A simple bot for managing mumble servers",
55
"license": "MIT",
6+
"type": "module",
67
"publishConfig": {
78
"access": "public"
89
},
@@ -19,9 +20,8 @@
1920
"scripts": {
2021
"lint": "eslint \"src/**/*.ts\"",
2122
"build": "tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",
22-
"test": "jest --watch",
23-
"test:ci": "NODE_ENV=test jest --ci",
24-
"test:e2e": "NODE_ENV=test jest --config e2e.jest.config.ts --runInBand",
23+
"test": "vitest",
24+
"test:e2e": "vitest --config ./e2e/vitest.config.ts",
2525
"release": "release-it"
2626
},
2727
"contributors": [
@@ -39,21 +39,20 @@
3939
"devDependencies": {
4040
"@release-it/conventional-changelog": "9.0.3",
4141
"@tsconfig/node16": "16.1.3",
42-
"@types/jest": "29.5.14",
4342
"@types/node": "22.10.0",
4443
"@typescript-eslint/eslint-plugin": "8.16.0",
4544
"@typescript-eslint/parser": "8.16.0",
4645
"eslint": "9.15.0",
4746
"eslint-config-prettier": "9.1.0",
4847
"eslint-plugin-prettier": "5.2.1",
49-
"jest": "29.7.0",
5048
"prettier": "3.4.1",
5149
"release-it": "17.10.0",
5250
"trace-unhandled": "2.0.1",
5351
"ts-jest": "29.2.5",
5452
"ts-node": "10.9.2",
5553
"tsc-alias": "1.8.10",
5654
"tsconfig-paths": "4.2.0",
57-
"typescript": "5.7.2"
55+
"typescript": "5.7.2",
56+
"vitest": "2.1.6"
5857
}
5958
}

0 commit comments

Comments
 (0)