本文へスキップ

Testing Soracom Orbit Soralets Inside the Development Environment

While you can test your code using any method that you prefer, you can use Jest to perform snapshop testing, which will store the output of a test in or...

コピー/保存

このページはまだ日本語では利用できません。現在は英語版を表示しています。ブラウザの翻訳機能をご利用ください。

ブラウザで翻訳する
  • Chrome / Edge: アドレスバーの翻訳アイコン、またはページを右クリックして「日本語に翻訳」を選択してください。
  • Safari: アドレスバーの「aA」メニューから「翻訳」を選択してください。

翻訳メニューが表示されない場合は、ブラウザ設定で翻訳機能が有効になっているか確認してください。

英語版を見る

Testing Inside the Development Environment

AssemblyScript

While you can test your code using any method that you prefer, you can use Jest to perform snapshop testing , which will store the output of a test in order to detect if the output changes when editing code.

This test will execute your code on the Node.js Orbit runtime-comptaible execution environment running inside the development container, which allows you test your code locally without deploying your code to Soracom.

  1. Define a test case in tests/inputs.ts

  2. Run the test using one of the following methods in VS Code:

    • Open the NPM Scripts view, select the test script, and click Run
    • Open the integrated terminal and run npm test
    • Open the command palette (⌘-⇧-P or Ctrl-Shift-P) and run the Run Test Task command
    • Run the test command using the F5 shortcut

    !!! Note that you cannot set breakpoints in AssemblyScript

When you define a new test case and run it for the first time, the tests/__snapshots__/ directory will be created.

When you modify your WASM module and the resulting test output changes, the test will result in an error containing the differences from the previous test found in tests/__snapshots__/. If the new test reflects the correct result, you can update the snapshot using the test:updateSnapshot script or npm test:updateSnapshot command.

Running the snapshot test will output a JSON file in the tests/inputs/ directory. This file can also be used as an input file when running tests remotely after uploading a WASM module to Soracom.

Rust

There are no test samples at this time.

C/C++

There are no test samples at this time.

TinyGo

There are no test samples at this time.

検索 Escで閉じる / Enterで検索結果