Skip to content

Commit

Permalink
ugly attempt to get windows msedge test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
redabacha committed Sep 2, 2024
1 parent ead6719 commit 78be9f6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 53 deletions.
17 changes: 16 additions & 1 deletion integration/helpers/vite.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Page } from "@playwright/test";
import { test as base, expect } from "@playwright/test";
import dedent from "dedent";
import execa from "execa";
import fse from "fs-extra";
import getPort from "get-port";
import glob from "glob";
Expand Down Expand Up @@ -311,6 +312,21 @@ export const test = base.extend<Fixtures>({
await use(async (files, template) => {
let port = await getPort();
let cwd = await createProject(await files({ port }), template);
// nasty hacks to try get windows msedge integration test to pass
await execa(denoBin, ["install", "--allow-scripts", "--no-lock"], {
cwd,
// @ts-expect-error broken global
env: { DENO_FUTURE: "1" },
stdio: "inherit",
});
await execa(
process.argv[0],
[
"./scripts/copy-build-to-dist.mjs",
`--deno-node-modules-paths=${cwd}/node_modules`,
],
{ stdio: "inherit" }
);
stop = await viteDevDeno({ cwd, port });
return { port, cwd };
});
Expand Down Expand Up @@ -386,7 +402,6 @@ function deno(
...process.env,
...colorEnv,
...options.env,
DENO_FUTURE: "1",
},
stdio: "pipe",
});
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"playground:new": "node ./scripts/playground/new.js",
"publish": "node ./scripts/publish.js",
"publish:private": "node ./scripts/publish-private.js",
"prepare": "node ./scripts/install-deno-deps.js integration/helpers/vite-deno-template templates/deno",
"release": "node ./scripts/release.js",
"test": "pnpm run \"/^test:.*/\"",
"pretest:integration": "pnpm build",
Expand Down
52 changes: 28 additions & 24 deletions scripts/copy-build-to-dist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import path from "node:path";
const args = process.argv.slice(2);
const tsc = process.env.CI || args.includes("--tsc");

// pnpm workspaces do not understand Deno projects and vice versa so we need a way to specify which projects need their node_modules updating
const denoNodeModulesPaths = args
.find((arg) => arg.includes("--deno-node-modules-paths="))
?.split("=")[1]
.split(",");
console.log("denoNodeModulesPaths", denoNodeModulesPaths);

const ROOT_DIR = process.cwd();
const PACKAGES_PATH = path.join(ROOT_DIR, "packages");
const DEFAULT_BUILD_PATH = path.join(ROOT_DIR, "build");

// pnpm workspaces do not understand Deno projects and vice versa so we need to specify which projects need their node_modules updating
const DENO_NODE_MODULES_PATHS = [
path.join(ROOT_DIR, "integration/helpers/vite-deno-template/node_modules"),
];

let activeOutputDir = DEFAULT_BUILD_PATH;
if (process.env.LOCAL_BUILD_DIRECTORY) {
let appDir = path.resolve(process.env.LOCAL_BUILD_DIRECTORY);
Expand Down Expand Up @@ -64,25 +66,27 @@ async function copyBuildToDist() {
let copyQueue = [];
for (let pkg of packages) {
try {
// Copy entire build artifact to node_modules dir for each Deno project that requires it
for (let denoNodeModulesPath of DENO_NODE_MODULES_PATHS) {
let destPath = path.join(denoNodeModulesPath, pkg.nodeModulesPath);
if (await fse.pathExists(destPath)) {
copyQueue.push(
(async () => {
console.log(
chalk.yellow(
` 🛠 🦕 Copying ${path.relative(
ROOT_DIR,
pkg.build
)} to ${path.relative(ROOT_DIR, destPath)}`
)
);
fse.copy(pkg.build, destPath, {
recursive: true,
});
})()
);
if (denoNodeModulesPaths) {
// Copy entire build artifact to node_modules dir for each Deno project that requires it
for (let denoNodeModulesPath of denoNodeModulesPaths) {
let destPath = path.join(denoNodeModulesPath, pkg.nodeModulesPath);
if (await fse.pathExists(destPath)) {
copyQueue.push(
(async () => {
console.log(
chalk.yellow(
` 🛠 🦕 Copying ${path.relative(
ROOT_DIR,
pkg.build
)} to ${path.relative(ROOT_DIR, destPath)}`
)
);
fse.copy(pkg.build, destPath, {
recursive: true,
});
})()
);
}
}
}

Expand Down
27 changes: 0 additions & 27 deletions scripts/install-deno-deps.js

This file was deleted.

0 comments on commit 78be9f6

Please sign in to comment.