Skip to content

Commit 85943c1

Browse files
CMCDragonkaitegefaulkes
authored andcommitted
WIP
1 parent 9fa4b84 commit 85943c1

21 files changed

+10758
-3302
lines changed

.eslintrc

+8-9
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77
"jest": true
88
},
99
"parser": "@typescript-eslint/parser",
10-
"extends": [
11-
"eslint:recommended",
12-
"plugin:@typescript-eslint/recommended",
13-
"plugin:prettier/recommended",
14-
"prettier"
15-
],
16-
"plugins": [
17-
"import"
18-
],
1910
"parserOptions": {
2011
"project": "tsconfig.json",
2112
"sourceType": "module"
2213
},
14+
"plugins": [
15+
"import"
16+
],
17+
"extends": [
18+
"eslint:recommended",
19+
"plugin:@typescript-eslint/recommended",
20+
"plugin:prettier/recommended"
21+
],
2322
"rules": {
2423
"linebreak-style": ["error", "unix"],
2524
"no-empty": 1,

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ npm install
9494
# build the dist
9595
npm run build
9696
# run the repl (this allows you to import from ./src)
97-
npm run ts-node
97+
npm run tsx
9898
# run the tests
9999
npm run test
100100
# lint the source code

jest.config.js renamed to jest.config.mjs

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
const path = require('path');
2-
const { pathsToModuleNameMapper } = require('ts-jest');
3-
const { compilerOptions } = require('./tsconfig');
1+
import path from 'node:path';
2+
import url from 'node:url';
3+
import tsconfigJSON from './tsconfig.json' assert { type: "json" };
44

5-
const moduleNameMapper = pathsToModuleNameMapper(compilerOptions.paths, {
6-
prefix: '<rootDir>/src/',
7-
});
5+
const projectPath = path.dirname(url.fileURLToPath(import.meta.url));
86

97
// Global variables that are shared across the jest worker pool
108
// These variables must be static and serializable
119
const globals = {
1210
// Absolute directory to the project root
13-
projectDir: __dirname,
11+
projectDir: projectPath,
1412
// Absolute directory to the test root
15-
testDir: path.join(__dirname, 'tests'),
13+
testDir: path.join(projectPath, 'tests'),
1614
// Default asynchronous test timeout
1715
defaultTimeout: 20000,
1816
// Timeouts rely on setTimeout which takes 32 bit numbers
@@ -24,7 +22,7 @@ const globals = {
2422
// They can however receive the process environment
2523
// Use `process.env` to set variables
2624

27-
module.exports = {
25+
const config = {
2826
testEnvironment: 'node',
2927
verbose: true,
3028
collectCoverage: false,
@@ -40,10 +38,10 @@ module.exports = {
4038
parser: {
4139
syntax: "typescript",
4240
tsx: true,
43-
decorators: compilerOptions.experimentalDecorators,
41+
decorators: tsconfigJSON.compilerOptions.experimentalDecorators,
4442
dynamicImport: true,
4543
},
46-
target: compilerOptions.target.toLowerCase(),
44+
target: tsconfigJSON.compilerOptions.target.toLowerCase(),
4745
keepClassNames: true,
4846
},
4947
}
@@ -77,5 +75,7 @@ module.exports = {
7775
'jest-extended/all',
7876
'<rootDir>/tests/setupAfterEnv.ts'
7977
],
80-
moduleNameMapper: moduleNameMapper,
78+
extensionsToTreatAsEsm: ['.ts'],
8179
};
80+
81+
export default config;

0 commit comments

Comments
 (0)