Skip to content

Commit 0b86c3d

Browse files
committed
ugly attempt to get windows msedge test passing
1 parent ead6719 commit 0b86c3d

File tree

4 files changed

+44
-53
lines changed

4 files changed

+44
-53
lines changed

Diff for: integration/helpers/vite.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Page } from "@playwright/test";
22
import { test as base, expect } from "@playwright/test";
33
import dedent from "dedent";
4+
import execa from "execa";
45
import fse from "fs-extra";
56
import getPort from "get-port";
67
import glob from "glob";
@@ -311,6 +312,21 @@ export const test = base.extend<Fixtures>({
311312
await use(async (files, template) => {
312313
let port = await getPort();
313314
let cwd = await createProject(await files({ port }), template);
315+
// nasty hacks to try get windows msedge integration test to pass
316+
await execa(denoBin, ["install", "--no-lock"], {
317+
cwd,
318+
// @ts-expect-error broken global
319+
env: { DENO_FUTURE: "1" },
320+
stdio: "inherit",
321+
});
322+
await execa(
323+
process.argv[0],
324+
[
325+
"./scripts/copy-build-to-dist.mjs",
326+
`--deno-node-modules-paths=${cwd}/node_modules`,
327+
],
328+
{ stdio: "inherit" }
329+
);
314330
stop = await viteDevDeno({ cwd, port });
315331
return { port, cwd };
316332
});
@@ -386,7 +402,6 @@ function deno(
386402
...process.env,
387403
...colorEnv,
388404
...options.env,
389-
DENO_FUTURE: "1",
390405
},
391406
stdio: "pipe",
392407
});

Diff for: package.json

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"playground:new": "node ./scripts/playground/new.js",
1818
"publish": "node ./scripts/publish.js",
1919
"publish:private": "node ./scripts/publish-private.js",
20-
"prepare": "node ./scripts/install-deno-deps.js integration/helpers/vite-deno-template templates/deno",
2120
"release": "node ./scripts/release.js",
2221
"test": "pnpm run \"/^test:.*/\"",
2322
"pretest:integration": "pnpm build",

Diff for: scripts/copy-build-to-dist.mjs

+28-24
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ import path from "node:path";
55
const args = process.argv.slice(2);
66
const tsc = process.env.CI || args.includes("--tsc");
77

8+
// pnpm workspaces do not understand Deno projects and vice versa so we need a way to specify which projects need their node_modules updating
9+
const denoNodeModulesPaths = args
10+
.find((arg) => arg.includes("--deno-node-modules-paths="))
11+
?.split("=")[1]
12+
.split(",");
13+
console.log("denoNodeModulesPaths", denoNodeModulesPaths);
14+
815
const ROOT_DIR = process.cwd();
916
const PACKAGES_PATH = path.join(ROOT_DIR, "packages");
1017
const DEFAULT_BUILD_PATH = path.join(ROOT_DIR, "build");
1118

12-
// pnpm workspaces do not understand Deno projects and vice versa so we need to specify which projects need their node_modules updating
13-
const DENO_NODE_MODULES_PATHS = [
14-
path.join(ROOT_DIR, "integration/helpers/vite-deno-template/node_modules"),
15-
];
16-
1719
let activeOutputDir = DEFAULT_BUILD_PATH;
1820
if (process.env.LOCAL_BUILD_DIRECTORY) {
1921
let appDir = path.resolve(process.env.LOCAL_BUILD_DIRECTORY);
@@ -64,25 +66,27 @@ async function copyBuildToDist() {
6466
let copyQueue = [];
6567
for (let pkg of packages) {
6668
try {
67-
// Copy entire build artifact to node_modules dir for each Deno project that requires it
68-
for (let denoNodeModulesPath of DENO_NODE_MODULES_PATHS) {
69-
let destPath = path.join(denoNodeModulesPath, pkg.nodeModulesPath);
70-
if (await fse.pathExists(destPath)) {
71-
copyQueue.push(
72-
(async () => {
73-
console.log(
74-
chalk.yellow(
75-
` 🛠 🦕 Copying ${path.relative(
76-
ROOT_DIR,
77-
pkg.build
78-
)} to ${path.relative(ROOT_DIR, destPath)}`
79-
)
80-
);
81-
fse.copy(pkg.build, destPath, {
82-
recursive: true,
83-
});
84-
})()
85-
);
69+
if (denoNodeModulesPaths) {
70+
// Copy entire build artifact to node_modules dir for each Deno project that requires it
71+
for (let denoNodeModulesPath of denoNodeModulesPaths) {
72+
let destPath = path.join(denoNodeModulesPath, pkg.nodeModulesPath);
73+
if (await fse.pathExists(destPath)) {
74+
copyQueue.push(
75+
(async () => {
76+
console.log(
77+
chalk.yellow(
78+
` 🛠 🦕 Copying ${path.relative(
79+
ROOT_DIR,
80+
pkg.build
81+
)} to ${path.relative(ROOT_DIR, destPath)}`
82+
)
83+
);
84+
fse.copy(pkg.build, destPath, {
85+
recursive: true,
86+
});
87+
})()
88+
);
89+
}
8690
}
8791
}
8892

Diff for: scripts/install-deno-deps.js

-27
This file was deleted.

0 commit comments

Comments
 (0)