Skip to content

Commit 5dc4576

Browse files
committed
Debug test esbuild not outputing files
1 parent 31e85e0 commit 5dc4576

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

.github/workflows/ci.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
if: steps.cache-build.outputs.cache-hit != 'true'
8484
run: yarn build:all
8585

86+
- run: yarn workspace @dd/tests build_esbuild || ls -la packages/tests/src/_playwright/projects/dist
8687
- run: yarn workspace @dd/tests e2e || ls -la packages/tests/src/_playwright/projects/dist
8788

8889
- name: Save playwright cache

packages/tests/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"scripts": {
2121
"build": "yarn clean && tsc",
22+
"build_esbuild": "ts-node -T --project ../tools/tsconfig.json ./src/buildEsbuild.ts",
2223
"clean": "rm -rf dist",
2324
"e2e": "FORCE_COLOR=true playwright test",
2425
"test": "FORCE_COLOR=true JEST_CONFIG_TRANSPILE_ONLY=true VITE_CJS_IGNORE_WARNING=true NODE_OPTIONS=\"--openssl-legacy-provider --experimental-vm-modules ${NODE_OPTIONS:-}\" jest",
@@ -57,6 +58,7 @@
5758
"nock": "14.0.0-beta.7",
5859
"rollup": "4.24.2",
5960
"strip-ansi": "6.0.1",
61+
"ts-node": "10.9.2",
6062
"typescript": "5.4.3",
6163
"vite": "5.4.10",
6264
"webpack": "5.92.1",

packages/tests/src/buildEsbuild.ts

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { Options } from '@dd/core/types';
2+
import { configEsbuild } from '@dd/tools/bundlers';
3+
import { debugFilesPlugins } from '@dd/tools/helpers';
4+
import { getEsbuildPlugin } from '@dd/tools/plugins';
5+
import * as esbuild from 'esbuild';
6+
import path from 'path';
7+
8+
const run = async () => {
9+
const cwd = path.resolve(__dirname, './_playwright/projects');
10+
const pluginConfig: Options = {
11+
auth: {
12+
apiKey: '123',
13+
appKey: '123',
14+
},
15+
rum: {
16+
sdk: {
17+
applicationId: '123',
18+
clientToken: '123',
19+
},
20+
},
21+
customPlugins: (opts, context) => [...debugFilesPlugins(context)],
22+
};
23+
const plugin = getEsbuildPlugin(pluginConfig);
24+
const config = configEsbuild({
25+
workingDir: cwd,
26+
entry: { esbuild: './index.js' },
27+
outDir: path.resolve(cwd, './dist'),
28+
plugins: [plugin],
29+
});
30+
31+
const result = await esbuild.build(config);
32+
33+
console.log(result);
34+
};
35+
36+
run();

yarn.lock

+1
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,7 @@ __metadata:
17921792
rollup: "npm:4.24.2"
17931793
strip-ansi: "npm:6.0.1"
17941794
ts-jest: "npm:29.1.2"
1795+
ts-node: "npm:10.9.2"
17951796
typescript: "npm:5.4.3"
17961797
vite: "npm:5.4.10"
17971798
webpack: "npm:5.92.1"

0 commit comments

Comments
 (0)