fix jest types by import @jest/globals

This commit is contained in:
wancat committed 2024-02-27 11:45:10 +08:00
1 parent 9e108e397b
commit b059cca7b2
8 files changed
+10 -2

No files matched your search

+2 -1
View File
@@ -63,9 +63,10 @@ module.exports = {
}, },
overrides: [ overrides: [
{ {
files: ['**/tests/**/*.js', '**/tests/**/*.ts'], // Adjust the pattern to match your test files files: ['**/tests/**/*.js', '**/tests/**/*.ts', '**/*.test.ts'], // Adjust the pattern to match your test files
rules: { rules: {
'import/extensions': 'off', // Turn off the rule for test files 'import/extensions': 'off', // Turn off the rule for test files
'import/no-extraneous-dependencies': 'off',
}, },
}, },
], ],
+1
View File
@@ -30,6 +30,7 @@
"build:quests": "yarn workspace server build:quests" "build:quests": "yarn workspace server build:quests"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^20.10.4", "@types/node": "^20.10.4",
"@typescript-eslint/eslint-plugin": "^6.14.0", "@typescript-eslint/eslint-plugin": "^6.14.0",
+2 -1
View File
@@ -1,4 +1,5 @@
import File from '../src/file' import { describe, test, expect } from '@jest/globals'
import File from '../src/file.js'
describe('File', () => { describe('File', () => {
let file: File let file: File
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import FileGraph from '../src/fileGraph.js' import FileGraph from '../src/fileGraph.js'
import FileNode from '../src/fileNode.js' import FileNode from '../src/fileNode.js'
@@ -1,3 +1,4 @@
import { describe, test, expect } from '@jest/globals'
import { DuplicateItemError, ParentNotExistsError } from '../src/errors.js' import { DuplicateItemError, ParentNotExistsError } from '../src/errors.js'
import FileNode from '../src/fileNode.js' import FileNode from '../src/fileNode.js'
import { FileObject } from '../src/file.js' import { FileObject } from '../src/file.js'
+1
View File
@@ -1,3 +1,4 @@
import { test, expect } from '@jest/globals'
import { isValidEmail, isValidUsername } from '../src/auth.js' import { isValidEmail, isValidUsername } from '../src/auth.js'
test('check valid username', () => { test('check valid username', () => {
+1
View File
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import { buildFileCheckCmd, File } from '../src/commands.js' import { buildFileCheckCmd, File } from '../src/commands.js'
describe('buildFileCheckCmd function', () => { describe('buildFileCheckCmd function', () => {
+1
View File
@@ -1,3 +1,4 @@
import { describe, it, expect } from '@jest/globals'
import DAG from '../src/dag.js' import DAG from '../src/dag.js'
describe('dag layers', () => { describe('dag layers', () => {