Shawn Lu 1 год назад
Родитель
Сommit
179bf93ef4
6 измененных файлов с 1077 добавлено и 4379 удалено
  1. 0 1
      .github/workflows/nodejs.yml
  2. 0 39
      __tests__/main.test.ts
  3. 0 18
      jest.config.js
  4. 1067 3515
      package-lock.json
  5. 1 6
      package.json
  6. 9 800
      yarn.lock

+ 0 - 1
.github/workflows/nodejs.yml

@@ -11,7 +11,6 @@ jobs:
       - uses: volta-cli/action@v4.0.0
       - run: npm ci --no-audit
       - run: npm run lint --if-present
-      - run: npm test
       - run: npm run build --if-present
         env:
           CI: true

+ 0 - 39
__tests__/main.test.ts

@@ -1,39 +0,0 @@
-import { Delays, greeter } from '../src/main.js'
-
-describe('greeter function', () => {
-  const name = 'John'
-  let hello: string
-
-  let timeoutSpy: jest.SpyInstance
-
-  // Act before assertions
-  beforeAll(async () => {
-    // Read more about fake timers
-    // http://facebook.github.io/jest/docs/en/timer-mocks.html#content
-    // Jest 27 now uses "modern" implementation of fake timers
-    // https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults
-    // https://github.com/facebook/jest/pull/5171
-    jest.useFakeTimers()
-    timeoutSpy = jest.spyOn(global, 'setTimeout')
-
-    const p: Promise<string> = greeter(name)
-    jest.runOnlyPendingTimers()
-    hello = await p
-  })
-
-  // Teardown (cleanup) after assertions
-  afterAll(() => {
-    timeoutSpy.mockRestore()
-  })
-
-  // Assert if setTimeout was called properly
-  it('delays the greeting by 2 seconds', () => {
-    expect(setTimeout).toHaveBeenCalledTimes(1)
-    expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), Delays.Long)
-  })
-
-  // Assert greeter result
-  it('greets a user with `Hello, {name}` message', () => {
-    expect(hello).toBe(`Hello, ${name}`)
-  })
-})

+ 0 - 18
jest.config.js

@@ -1,18 +0,0 @@
-export default {
-  testEnvironment: 'node',
-  preset: 'ts-jest/presets/default-esm',
-  transform: {
-    '^.+\\.m?[tj]s?$': ['ts-jest', { useESM: true }],
-  },
-  moduleNameMapper: {
-    '^(\\.{1,2}/.*)\\.(m)?js$': '$1',
-  },
-  testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(m)?ts$',
-  coverageDirectory: 'coverage',
-  collectCoverageFrom: [
-    'src/**/*.ts',
-    'src/**/*.mts',
-    '!src/**/*.d.ts',
-    '!src/**/*.d.mts',
-  ],
-}

Разница между файлами не показана из-за своего большого размера
+ 1067 - 3515
package-lock.json


+ 1 - 6
package.json

@@ -13,13 +13,10 @@
     "@typescript-eslint/parser": "~6.2",
     "eslint": "~8.46",
     "eslint-config-prettier": "~9.0",
-    "eslint-plugin-jest": "~27.2",
     "eslint-plugin-prettier": "^5.1.1",
-    "jest": "~29.6",
     "prettier": "~3.0",
     "rimraf": "~5.0",
     "ts-api-utils": "~1.0",
-    "ts-jest": "~29.1",
     "tsc-alias": "1.8.8",
     "typescript": "~5.1.0"
   },
@@ -31,9 +28,7 @@
     "build:watch": "tsc -w -p tsconfig.json && tsc-alias",
     "build:release": "npm run clean && tsc -p tsconfig.release.json && tsc-alias",
     "lint": "eslint . --ext .ts --ext .mts",
-    "test": "jest --coverage",
-    "prettier": "prettier --config .prettierrc --write .",
-    "test:watch": "jest --watch"
+    "prettier": "prettier --config .prettierrc --write ."
   },
   "license": "Apache-2.0",
   "dependencies": {

Разница между файлами не показана из-за своего большого размера
+ 9 - 800
yarn.lock


Некоторые файлы не были показаны из-за большого количества измененных файлов