[TS] Fixup TS test run at CI (#9004)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c50c6af..c7cae71 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -545,7 +545,7 @@
       # FIXME: make test script not rely on flatc
       run: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_INSTALL=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF . && make -j
     - name: pnpm
-      run: npm install -g pnpm esbuild
+      run: npm install -g pnpm
     - name: deps
       run: pnpm i
     - name: compile
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9d57917..315c14c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -33,6 +33,12 @@
         specifier: ^8.34.1
         version: 8.34.1(eslint@9.29.0)(typescript@5.8.3)
 
+  tests/ts:
+    dependencies:
+      flatbuffers:
+        specifier: workspace:*
+        version: link:../..
+
 packages:
 
   '@esbuild/aix-ppc64@0.25.5':
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
new file mode 100644
index 0000000..340c44e
--- /dev/null
+++ b/pnpm-workspace.yaml
@@ -0,0 +1,2 @@
+packages:
+  - tests/ts
diff --git a/tests/ts/TypeScriptTest.py b/tests/ts/TypeScriptTest.py
index 9c1765f..7bf4317 100755
--- a/tests/ts/TypeScriptTest.py
+++ b/tests/ts/TypeScriptTest.py
@@ -62,16 +62,10 @@
 
 # Execute esbuild with the specified parameters
 def esbuild(input, output):
-  cmd = ["esbuild", input, "--outfile=" + output]
+  cmd = ["../../node_modules/.bin/esbuild", input, "--outfile=" + output]
   cmd += ["--format=cjs", "--bundle", "--external:flatbuffers"]
   check_call(cmd)
 
-
-print("Removing node_modules/ directory...")
-shutil.rmtree(Path(tests_path, "node_modules"), ignore_errors=True)
-
-check_call(["npm", "install", "--silent"])
-
 flatc(
     options=[
         "--ts",
@@ -228,12 +222,12 @@
 )
 
 print("Running TypeScript Compiler...")
-check_call(["tsc"])
+check_call(["../../node_modules/.bin/tsc"])
 print(
     "Running TypeScript Compiler in old node resolution mode for"
     " no_import_ext..."
 )
-check_call(["tsc", "-p", "./tsconfig.node.json"])
+check_call(["../../node_modules/.bin/tsc", "-p", "./tsconfig.node.json"])
 
 NODE_CMD = ["node"]
 
diff --git a/tests/ts/package.json b/tests/ts/package.json
index 1639cf8..6afc785 100644
--- a/tests/ts/package.json
+++ b/tests/ts/package.json
@@ -1,6 +1,6 @@
 {
     "type": "module",
     "dependencies": {
-        "flatbuffers": "../../"
+        "flatbuffers": "workspace:*"
     }
 }
diff --git a/tests/ts/pnpm-lock.yaml b/tests/ts/pnpm-lock.yaml
deleted file mode 100644
index 730e4d7..0000000
--- a/tests/ts/pnpm-lock.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-lockfileVersion: '6.0'
-
-settings:
-  autoInstallPeers: true
-  excludeLinksFromLockfile: false
-
-dependencies:
-  flatbuffers:
-    specifier: ../../
-    version: link:../..