Merge branch '5-create-basic-testing-setup' into 'main'

Resolve "Create basic testing setup."

Closes #5

See merge request finvis/usxi!5
This commit is contained in:
Carter Bertolini 2023-10-06 17:33:36 -04:00
commit 093fa54126
7 changed files with 3362 additions and 3 deletions

View File

@ -1,3 +1,4 @@
dist
node_modules
.eslintrc.js
jest.config.ts

View File

@ -3,7 +3,7 @@ module.exports = {
parserOptions: {
ecmaVersion: "latest", // Allows the use of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
project: "./tsconfig.json"
project: ["./tsconfig.json", "./tsconfig.test.json"]
},
extends: ["plugin:@typescript-eslint/recommended"], // Uses the linting rules from @typescript-eslint/eslint-plugin
env: {

13
jest.config.ts Normal file
View File

@ -0,0 +1,13 @@
import type { Config } from '@jest/types'
const config: Config.InitialOptions =
{
transform:
{
'^.+\\.tsx?$': 'ts-jest',
},
collectCoverageFrom: ['src/*.ts'],
}
export default config

3324
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,16 +5,22 @@
"main": "index.js",
"scripts": {
"start": "node dist/index.js",
"lint": "eslint . --fix"
"lint": "eslint src/ --fix",
"lint-test": "eslint test/ --fix",
"test": "jest test/ --config jest.config.ts"
},
"author": "",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@tsconfig/node-lts": "^18.12.5",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.2",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.50.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"dependencies": {

7
test/basic.test.ts Normal file
View File

@ -0,0 +1,7 @@
import {describe, expect, test} from '@jest/globals';
describe('sum module', () => {
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});

8
tsconfig.test.json Normal file
View File

@ -0,0 +1,8 @@
{
"extends": "@tsconfig/node-lts/tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["test"],
"exclude": ["node_modules"]
}