memochou1993 / gpt-ai-assistant

OpenAI + LINE + Vercel = GPT AI Assistant
https://memochou1993.github.io/gpt-ai-assistant-docs/
MIT License
7.23k stars 9.33k forks source link

如何執行專案中的測試 #326

Closed wei-yuan closed 4 months ago

wei-yuan commented 4 months ago

作者們好:

問題

請問如何正確地執行測試?


以下是執行測試的時候產生的結果

失敗畫面

image

錯誤訊息

圖片版本

image

文字版本

TestRun "gpt-line-bot:runTest: orta.vscode-jest:TestProvider:gpt-line-bot:7 (0)" started

gpt-ai-assistant@4.8.3 test jest --testLocationInResults --json --useStderr --outputFile C:\Users\ax613\AppData\Local\Temp\jest_runner_gpt_line_bot_ax613_2.json --testNamePattern COMMAND_BOT_DRAW$ --no-coverage --reporters default --reporters c:\Users\ax613.vscode\extensions\orta.vscode-jest-6.2.3\out\reporter.js --colors --watchAll=false --testPathPattern d:\gpt-line-bot\tests\draw.test.js

FAIL tests/draw.test.js ● Test suite failed to run

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

  1 | import { TYPE_SYSTEM } from '../../constants/command.js';
  2 | import { t } from '../../locales/index.js';
> 3 | import Command from './command.js';
    |                                    ^
  4 |
  5 | export default new Command({
  6 |   type: TYPE_SYSTEM,

  at _iterableToArray (app/commands/bot-image-edit.js:3:36)
  at _iterableToArray (app/commands/bot-image-edit.js:3:36)
  at Object._toConsumableArray (app/commands/bot-image-edit.js:10:10)
  at Object.require (app/commands/index.js:14:1)
  at Object.require (utils/get-command.js:1:1)
  at Object.require (utils/index.js:12:1)
  at Object.require (app/app.js:1:1)
  at Object.require (app/index.js:1:1)
  at Object.require (tests/draw.test.js:4:1)

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 1.424 s Ran all test suites matching /d:\gpt-line-bot\tests\draw.test.js/i with tests matching "COMMAND_BOT_DRAW$".

目前的開發測試環境

謝謝!

memochou1993 commented 4 months ago
image

Ref: https://memochou1993.github.io/gpt-ai-assistant-docs/development.html#執行測試