mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
fix: setup Jest with TS
This commit is contained in:
1 parent
557af91d4b
commit
a18e0d9b68
12 files changed
+45
-9
No files matched your search
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||||
|
// const { jsWithTs: tsjPreset } = require('ts-jest/presets')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
preset: 'ts-jest/presets/js-with-ts',
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import File from '../src/file'
|
import File from '../src/file'
|
||||||
|
|
||||||
describe('File', () => {
|
describe('File', () => {
|
||||||
let file
|
let file: File
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
file = new File({ path: '/home/user', type: 'folder', discovered: true })
|
file = new File({ path: '/home/user', type: 'folder', discovered: true })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@linux-odyssey/utils",
|
"name": "@linux-odyssey/utils",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "dist/index.js",
|
||||||
"type": "module",
|
"type": "commonjs",
|
||||||
"exports": "./index.js",
|
"exports": "./dist/index.js",
|
||||||
"license": "MIT"
|
"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', () => {
|
test('check valid username', () => {
|
||||||
const valid = ['alex', 'alex123', 'john_doe', 'john-doe', 'rudeus']
|
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', () => {
|
describe('buildFileCheckCmd function', () => {
|
||||||
it('builds the file check command correctly', () => {
|
it('builds the file check command correctly', () => {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import DAG from './dag.js'
|
import DAG from '../src/dag'
|
||||||
|
|
||||||
describe('dag layers', () => {
|
describe('dag layers', () => {
|
||||||
it('two layer', () => {
|
it('two layer', () => {
|
||||||
@@ -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"]
|
||||||
|
}
|
||||||
@@ -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"]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user