Skip to content

Commit e6daa82

Browse files
committed
Move test files to tests directory
1 parent 00d6767 commit e6daa82

8 files changed

Lines changed: 47 additions & 6 deletions

File tree

‎packages/playground/mcp/playwright.config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig, devices } from '@playwright/test';
22

33
export default defineConfig({
4-
testDir: './e2e',
4+
testDir: './tests/e2e',
55
fullyParallel: false,
66
forbidOnly: !!process.env.CI,
77
retries: process.env.CI ? 2 : 0,

‎packages/playground/mcp/project.json‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@
4343
}
4444
}
4545
},
46-
"test:mcp": {
46+
"test:unit": {
47+
"executor": "@nx/vite:test",
48+
"outputs": ["{workspaceRoot}/coverage/packages/playground/mcp"],
49+
"options": {
50+
"passWithNoTests": true,
51+
"reportsDirectory": "../../../coverage/packages/playground/mcp"
52+
}
53+
},
54+
"test:e2e": {
4755
"executor": "nx:run-commands",
4856
"options": {
4957
"commands": [
@@ -56,6 +64,10 @@
5664
"parallel": false
5765
}
5866
},
67+
"test:mcp": {
68+
"executor": "nx:noop",
69+
"dependsOn": ["test:unit", "test:e2e"]
70+
},
5971
"package-for-self-hosting": {
6072
"executor": "@wp-playground/nx-extensions:package-for-self-hosting",
6173
"dependsOn": ["build"]

packages/playground/mcp/e2e/mcp-tools.spec.ts renamed to packages/playground/mcp/tests/e2e/mcp-tools.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const test = base.extend<McpTestFixtures, McpWorkerFixtures>({
2929
'--experimental-strip-types',
3030
'--experimental-transform-types',
3131
'--import',
32-
'../../../meta/src/node-es-module-loader/register.mts',
33-
'../src/index.ts',
32+
'../../../../meta/src/node-es-module-loader/register.mts',
33+
'../../src/index.ts',
3434
`--port=${MCP_WS_PORT}`,
3535
],
3636
cwd: dirname(fileURLToPath(import.meta.url)),
File renamed without changes.

packages/playground/mcp/src/bridge-server.spec.ts renamed to packages/playground/mcp/tests/unit/bridge-server.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, afterEach } from 'vitest';
22
import WebSocket from 'ws';
3-
import { PlaygroundBridge } from './bridge-server';
3+
import { PlaygroundBridge } from '../../src/bridge-server';
44

55
// Use high random port to avoid conflicts
66
const getPort = () => 19000 + Math.floor(Math.random() * 1000);

‎packages/playground/mcp/tsconfig.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
},
1212
"files": [],
1313
"include": [],
14-
"references": [{ "path": "./tsconfig.lib.json" }]
14+
"references": [
15+
{ "path": "./tsconfig.lib.json" },
16+
{ "path": "./tsconfig.spec.json" }
17+
]
1518
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../../dist/out-tsc",
5+
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
6+
},
7+
"include": [
8+
"vite.config.ts",
9+
"tests/**/*.spec.ts",
10+
"tests/**/*.test.ts",
11+
"src/**/*.d.ts"
12+
]
13+
}

‎packages/playground/mcp/vite.config.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="vitest" />
12
import { defineConfig } from 'vite';
23

34
import dts from 'vite-plugin-dts';
@@ -46,4 +47,16 @@ export default defineConfig({
4647
},
4748
},
4849
},
50+
51+
test: {
52+
globals: true,
53+
cache: {
54+
dir: '../../../node_modules/.vitest',
55+
},
56+
environment: 'node',
57+
include: [
58+
'tests/unit/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
59+
],
60+
reporters: ['default'],
61+
},
4962
});

0 commit comments

Comments
 (0)