File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed
Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,28 @@ export * from "@deno/loader";
1212export async function createLoader (
1313 workspaceOptions : WorkspaceOptions ,
1414 loaderOptions : LoaderOptions ,
15+ ) {
16+ const { loader, workspace, diagnostics } = await createLoaderWithDiagnostics (
17+ workspaceOptions ,
18+ loaderOptions ,
19+ ) ;
20+ assertEquals ( diagnostics , [ ] ) ;
21+ return {
22+ loader,
23+ workspace,
24+ } ;
25+ }
26+
27+ export async function createLoaderWithDiagnostics (
28+ workspaceOptions : WorkspaceOptions ,
29+ loaderOptions : LoaderOptions ,
1530) {
1631 const workspace = new Workspace ( workspaceOptions ) ;
1732 const { loader, diagnostics } = await workspace . createLoader ( loaderOptions ) ;
18- assertEquals ( diagnostics , [ ] ) ;
1933 return {
2034 loader,
2135 workspace,
36+ diagnostics,
2237 } ;
2338}
2439
Original file line number Diff line number Diff line change 1+ import { assertEquals } from "@std/assert" ;
2+ import { createLoaderWithDiagnostics } from "../helpers.ts" ;
3+
4+ Deno . test ( "loads linked entrypoint" , async ( ) => {
5+ const mainFile = import . meta. dirname + "/testdata/main.ts" ;
6+ const { diagnostics } = await createLoaderWithDiagnostics ( {
7+ configPath : import . meta. dirname + "/testdata/deno.json" ,
8+ } , {
9+ entrypoints : [ mainFile ] ,
10+ } ) ;
11+
12+ assertEquals ( diagnostics . length , 1 ) ;
13+ const expectedMessage =
14+ 'Relative import path "unknown" not prefixed with / or ./ or ../' ;
15+ assertEquals (
16+ diagnostics [ 0 ] . message . substring ( 0 , expectedMessage . length ) ,
17+ expectedMessage ,
18+ ) ;
19+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ }
Original file line number Diff line number Diff line change 1+ import "unknown" ;
You can’t perform that action at this time.
0 commit comments