Skip to content

Commit aededb9

Browse files
committed
Update e2e suite
1 parent 902f5cc commit aededb9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

packages/cli-v3/e2e/compile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export async function compile(options: CompileOptions) {
214214
await writeFile(join(tempDir, "index.js"), entryPointOutputFile.text);
215215

216216
return {
217+
directDependenciesMeta,
217218
workerMetaOutput: metaOutput,
218219
workerOutputFile,
219220
entryPointMetaOutput,

packages/cli-v3/e2e/handleDependencies.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ import { PackageManager } from "../src/utilities/getUserPackageManager.js";
1616
import { logger } from "../src/utilities/logger.js";
1717
import { cliLink } from "../src/utilities/cliOutput.js";
1818
import { E2EJavascriptProject } from "./javascriptProject.js";
19+
import { DependencyMeta } from "../src/utilities/javascriptProject.js";
1920

2021
type HandleDependenciesOptions = {
22+
directDependenciesMeta: Record<string, DependencyMeta>;
2123
entryPointMetaOutput: Metafile["outputs"]["out/stdin.js"];
2224
metaOutput: Metafile["outputs"]["out/stdin.js"];
2325
packageManager: PackageManager;
@@ -30,24 +32,22 @@ export async function handleDependencies(options: HandleDependenciesOptions) {
3032
throw new Error("cannot resolve config");
3133
}
3234
const {
35+
directDependenciesMeta,
3336
entryPointMetaOutput,
3437
metaOutput,
3538
packageManager,
3639
resolvedConfig: { config },
3740
tempDir,
3841
} = options;
3942

40-
logger.debug("Getting the imports for the worker and entryPoint builds", {
43+
logger.debug("Imports for the worker and entryPoint builds", {
4144
workerImports: metaOutput.imports,
4245
entryPointImports: entryPointMetaOutput.imports,
4346
});
4447

45-
// Get all the required dependencies from the metaOutputs and save them to /tmp/dir/package.json
46-
const allImports = [...metaOutput.imports, ...entryPointMetaOutput.imports];
47-
4848
const javascriptProject = new E2EJavascriptProject(config.projectDir, packageManager);
4949

50-
const dependencies = await resolveRequiredDependencies(allImports, config, javascriptProject);
50+
const dependencies = await resolveRequiredDependencies(directDependenciesMeta, config);
5151

5252
logger.debug("gatherRequiredDependencies()", { dependencies });
5353

packages/cli-v3/e2e/index.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { E2EOptions, E2EOptionsSchema } from "./schemas";
2020
import { fixturesConfig, TestCase } from "./fixtures.config";
2121
import { Metafile, OutputFile } from "esbuild";
2222
import { findUpMultiple } from "find-up";
23+
import { DependencyMeta } from "../src/utilities/javascriptProject";
2324

2425
interface E2EFixtureTest extends TestCase {
2526
fixtureDir: string;
@@ -163,6 +164,7 @@ if (testCases.length > 0) {
163164
).resolves.not.toThrowError();
164165
}
165166

167+
let directDependenciesMeta: Record<string, DependencyMeta>;
166168
let entryPointMetaOutput: Metafile["outputs"]["out/stdin.js"];
167169
let entryPointOutputFile: OutputFile;
168170
let workerMetaOutput: Metafile["outputs"]["out/stdin.js"];
@@ -175,6 +177,7 @@ if (testCases.length > 0) {
175177
resolvedConfig: resolvedConfig!,
176178
tempDir,
177179
});
180+
directDependenciesMeta = compilationResult.directDependenciesMeta;
178181
entryPointMetaOutput = compilationResult.entryPointMetaOutput;
179182
entryPointOutputFile = compilationResult.entryPointOutputFile;
180183
workerMetaOutput = compilationResult.workerMetaOutput;
@@ -201,6 +204,7 @@ if (testCases.length > 0) {
201204
const depsExpectation = expect(
202205
(async () => {
203206
dependencies = await handleDependencies({
207+
directDependenciesMeta: directDependenciesMeta!,
204208
entryPointMetaOutput: entryPointMetaOutput!,
205209
metaOutput: workerMetaOutput!,
206210
resolvedConfig: resolvedConfig!,

0 commit comments

Comments
 (0)