fix: setup Jest with TS

This commit is contained in:
Lin, Hung-Shin authored and wancat committed 2024-01-29 12:42:50 +08:00
1 parent 557af91d4b
commit a18e0d9b68
12 files changed
+45 -9

No files matched your search

+3 -1
View File
@@ -1,5 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
// const { jsWithTs: tsjPreset } = require('ts-jest/presets')
module.exports = {
preset: 'ts-jest',
preset: 'ts-jest/presets/js-with-ts',
testEnvironment: 'node',
}
+1 -1
View File
@@ -1,7 +1,7 @@
import File from '../src/file'
describe('File', () => {
let file
let file: File
beforeEach(() => {
file = new File({ path: '/home/user', type: 'folder', discovered: true })
})
+8 -4
View File
@@ -1,8 +1,12 @@
{
"name": "@linux-odyssey/utils",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"exports": "./index.js",
"license": "MIT"
"main": "dist/index.js",
"type": "commonjs",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"scripts": {
"build": "tsc"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
import { isValidEmail, isValidUsername } from './auth.js'
import { isValidEmail, isValidUsername } from '../src/auth'
test('check valid username', () => {
const valid = ['alex', 'alex123', 'john_doe', 'john-doe', 'rudeus']
@@ -1,4 +1,4 @@
import { buildFileCheckCmd } from './commands.js'
import { buildFileCheckCmd } from '../src/commands'
describe('buildFileCheckCmd function', () => {
it('builds the file check command correctly', () => {
@@ -1,4 +1,4 @@
import DAG from './dag.js'
import DAG from '../src/dag'
describe('dag layers', () => {
it('two layer', () => {
+15
View File
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
"outDir": "./dist",
"declaration": true,
"sourceMap": true,
"allowJs": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
+15
View File
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
"outDir": "./dist",
"declaration": true,
"sourceMap": true,
"allowJs": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}