本文へスキップ
製品デスクトップツールTASTECAD図面の確認TASTEFILESファイル管理TASTEFTPファイル転送TASTESSHリモートワークスペースTASTEZIP圧縮と展開TASTEWINMファイル管理開発ツールTASTECODERust 統合開発環境TASTESTUDIO統合開発・テスト環境TASTEETLデータ統合(ETL)サーバーTASTEREMOTEリモートデスクトップサーバーTASTEGEO空間情報サーバーTASTEMAILメールワークスペース投資TASTESTOCK株式自動売買デスクトップアプリはじめるダウンロードドキュメント購入すべての製品
マーケットプレイス
ニュース
技術ニュース今日の開発ニュース開発ドキュメントプログラミング言語RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWebフロントエンド フレームワークNext.jsReactVue.js · NuxtSvelteKitAngularサーバー フレームワークSpring BootDjangoFastAPIASP.NET CoreNestJS · Expressアプリ・デスクトップ フレームワークTauriFlutterReact NativeElectronアルゴリズムアルゴリズムの基礎主要アルゴリズム発展アルゴリズム実務のアルゴリズム
コミュニティプロジェクト開発ログプロンプトAIツールの問題ショーケースコミュニティガイド
協業技術移転ウェブサイト構築デスクトップアプリ構築リリース・決済パイプライン販売パートナーお問い合わせ
サービスリモートデスクトップインストールパッケージのカスタマイズ
TASTEDEV
製品

デスクトップツール

TASTECAD複雑な図面を、軽やかにひらくTASTEFILES必要なファイルだけを、最速でTASTEFTPファイルが行き交う、いちばん端正な道TASTESSHサーバーとあなたを、より確かにつなぐTASTEZIPより速くまとめ、より安全にひらくTASTEWINM2つの画面で整理する、キーボード中心のファイルマネージャー

開発ツール

TASTECODERust アプリの編集・ビルド・デバッグ・テストまでひとつのウィンドウでTASTESTUDIO編集からリモートテスト、承認した AI 修正までTASTEETL値を見ながら、データを運ぶ

サーバー

TASTEREMOTE自社サーバーで運用するリモートデスクトップTASTEGEOGeoServer 互換の空間情報サーバーを Rust で作り直しますTASTEMAILメールの主導権を、もう一度自分の手に

投資

TASTESTOCKいつ・何を。自分で決めたルールどおりに動く株式自動売買

はじめる

ダウンロード全製品の最新版ドキュメント各製品の使い方購入サブスクリプション・永久ライセンスすべての製品全製品を一覧で
すべての製品
マーケットプレイスニュース
技術

ニュース

今日の開発ニュース言語・フレームワーク・GitHub・AI の公式発表開発ドキュメント言語・フレームワーク・アルゴリズムのガイド

プログラミング言語

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

フレームワーク

Webフロントエンド フレームワークNext.jsReactVue.js · NuxtSvelteKitAngular
サーバー フレームワークSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
アプリ・デスクトップ フレームワークTauriFlutterReact NativeElectron

アルゴリズム

アルゴリズムの基礎計算量解析 · ソート · 探索 · 基本データ構造 · 木構造とヒープ主要アルゴリズムグラフ探索 · 最短経路と最小全域木 · 動的計画法 · 貪欲法 · 分割統治法 · バックトラッキング発展アルゴリズム文字列アルゴリズム · 数学と整数論 · ビット演算 · セグメント木 · Union-Find実務のアルゴリズムコーディング面接対策 · LRUキャッシュ · レート制限 · コンシステントハッシュ法
開発ドキュメントをすべて見る
コミュニティ
プロジェクトビルダーと作品を探す開発ログ決定と試行錯誤プロンプト再利用できる指示AIツールの問題Claude・Codex・Gemini の問題と回避策ショーケース完成した成果コミュニティガイドオープンにつくる方法
協業
技術移転Rust・egui でネイティブアプリを作るウェブサイト構築10言語、アカウント、ドキュメントとダウンロードデスクトップアプリ構築Rust・egui、WebView なしリリース・決済パイプライン署名・MSI・deb・rpm・AppImage・ハッシュ販売パートナー紹介して決済額の30%お問い合わせ構築・提携・投資のご相談
サービス
リモートデスクトップブラウザから自分のパソコンへインストールパッケージのカスタマイズ必要な機能だけ、設定は事前に
購入
JA
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
ログイン
ログイン
TASTEDEV

小さなツールから、より良い開発へ。

support@tastedev.netTASTEDEVを支援
製品製品ラインナップ購入ドキュメントダウンロードマーケットプレイスサポート
コミュニティプロジェクト開発ログプロンプトAIツールの問題ショーケース
ポリシー会社概要プライバシーポリシー利用規約サブスクリプション規約返金ポリシーコミュニティガイドライン
アカウントログイン新規登録
訪問者
今日
昨日
累計閲覧
商号
GXSOFT
代表者
CHOI YOUNG GU
事業者登録番号
853-44-00368
所在地
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
電話
+82-10-4404-1523
メール
whitecalvin@tastedev.net
個人情報保護責任者
CHOI YOUNG GU

© 2026 TASTEDEV製品情報は検証済みの開発ソースに基づいています。リリース・改善中

Vue.js · Nuxt ドキュメント
Vue.js · Nuxt
Getting Started with Vue and NuxtProject StructureCore Concepts: SFCs, Reactivity, Components, Nuxt RoutingData and StateTestingBuild and Deployment
ディスカッション

Vue.js · Nuxt ガイド · 5/6

Testing

この章は現在、英語でのみ提供しています。

Tests in a Vue project usually come in three layers. Pure logic such as composables and stores is checked with Vitest, components with Vitest plus Vue Test Utils, and real user flows with an end-to-end tool such as Playwright. In Nuxt projects, @nuxt/test-utils boots a Nuxt environment inside your tests.

Setting up Vitest

If you selected Vitest in create-vue, everything is already configured. To add it by hand, install these packages:

npm install -D vitest @vue/test-utils jsdom

vitest.config.ts extends the Vite config and selects the jsdom environment, which emulates browser APIs:

import { fileURLToPath } from "node:url";
import { mergeConfig, defineConfig, configDefaults } from "vitest/config";
import viteConfig from "./vite.config";

export default mergeConfig(
  viteConfig,
  defineConfig({
    test: {
      environment: "jsdom",
      exclude: [...configDefaults.exclude, "e2e/**"],
      root: fileURLToPath(new URL("./", import.meta.url)),
    },
  }),
);

npm run test:unit (or npx vitest) runs tests in watch mode, re-running only the affected tests each time you save.

Testing logic and stores

Call a composable like any function and assert on the result. For Pinia stores, activate a fresh Pinia before each test so tests do not leak state into each other.

import { describe, it, expect, beforeEach } from "vitest";
import { setActivePinia, createPinia } from "pinia";
import { useCounter } from "@/composables/useCounter";
import { useCartStore } from "@/stores/cart";

describe("useCounter", () => {
  it("increments and doubles", () => {
    const { count, double, increment } = useCounter(1);
    increment();
    expect(count.value).toBe(2);
    expect(double.value).toBe(4);
  });
});

describe("cart store", () => {
  beforeEach(() => setActivePinia(createPinia()));

  it("increases quantity for the same item", () => {
    const cart = useCartStore();
    cart.add({ id: 1, name: "Book", price: 100 });
    cart.add({ id: 1, name: "Book", price: 100 });
    expect(cart.items[0].qty).toBe(2);
    expect(cart.total).toBe(200);
  });
});

Testing components

mount from Vue Test Utils renders a component and returns a wrapper. Pass props, find elements, trigger events, then assert on the rendered text or emitted events. DOM updates are asynchronous, so await calls to trigger and setValue.

import { describe, it, expect } from "vitest";
import { mount } from "@vue/test-utils";
import TodoItem from "@/components/TodoItem.vue";

describe("TodoItem", () => {
  it("renders the text and emits remove", async () => {
    const wrapper = mount(TodoItem, { props: { text: "Groceries", done: false } });

    expect(wrapper.text()).toContain("Groceries");

    await wrapper.find("button").trigger("click");
    expect(wrapper.emitted("remove")?.[0]).toEqual(["user"]);
  });
});
この章について質問がありますか?
前の章Data and State次の章Build and Deployment

Components that rely on global plugins can receive them with mount(Comp, { global: { plugins: [router, createPinia()] } }). Tests that assert on what the user sees, rather than on implementation details, survive refactoring much better.

Nuxt test utilities

Nuxt components depend on auto-imports and Nuxt composables, so they will not run in a plain jsdom environment. @nuxt/test-utils provides a nuxt environment that boots the Nuxt runtime inside tests, plus mountSuspended.

npm install -D @nuxt/test-utils vitest @vue/test-utils happy-dom
// vitest.config.ts
import { defineVitestConfig } from "@nuxt/test-utils/config";

export default defineVitestConfig({
  test: { environment: "nuxt" },
});
// tests/counter.nuxt.test.ts
import { it, expect } from "vitest";
import { mountSuspended } from "@nuxt/test-utils/runtime";
import AppCounter from "~/components/AppCounter.vue";

it("renders inside the Nuxt environment", async () => {
  const wrapper = await mountSuspended(AppCounter);
  expect(wrapper.text()).toContain("0");
});

mountSuspended waits for async setup and useFetch to resolve before returning. You can mock server API calls with registerEndpoint.

End-to-end tests with Playwright

End-to-end tests open the app in a real browser and drive it like a user would. Select Playwright in create-vue, or add it with npm init playwright@latest.

// e2e/home.spec.ts
import { test, expect } from "@playwright/test";

test("filters the list by search query", async ({ page }) => {
  await page.goto("/");
  await page.getByPlaceholder("Search").fill("Vue");
  await expect(page.getByRole("listitem")).toHaveCount(1);
});

Set the webServer option in playwright.config.ts to the command that starts your dev or preview server, and Playwright launches it before the tests. Run npx playwright test, and add --ui to step through tests interactively.

Summary

  • Check logic, stores and components quickly with Vitest and Vue Test Utils.
  • In Pinia store tests, call setActivePinia(createPinia()) before each test.
  • Test Nuxt components with the nuxt environment and mountSuspended from @nuxt/test-utils.
  • Verify critical user flows in a real browser with Playwright end-to-end tests.

コメント 0件

人気のコメント順新しい順

ログイン · ログインするとコメントできます。