Skip to content

Commit 9ad666c

Browse files
author
Dane Pilcher
committed
test: use file url for dynamic import
1 parent 80684b5 commit 9ad666c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.eslint_dictionary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"hotfix",
7777
"hotswap",
7878
"hotswapped",
79+
"href",
7980
"iamv2",
8081
"identitypool",
8182
"idps",

packages/backend-data/src/convert_js_resolvers.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@aws-amplify/data-construct';
99
import { join, resolve } from 'path';
1010
import { tmpdir } from 'os';
11-
import { fileURLToPath } from 'url';
11+
import { fileURLToPath, pathToFileURL } from 'url';
1212
import {
1313
convertJsResolverDefinition,
1414
defaultJsResolverCode,
@@ -43,7 +43,9 @@ void describe('defaultJsResolverCode', () => {
4343
const filename = join(tempDir, 'js_resolver_handler.js');
4444
writeFileSync(filename, code);
4545

46-
const resolver = await import(filename);
46+
// windows requires dynamic imports to use file urls
47+
const fileUrl = pathToFileURL(filename).href;
48+
const resolver = await import(fileUrl);
4749
const context = { stash: {}, prev: { result: 'result' } };
4850
assert.deepEqual(resolver.request(context), {});
4951

0 commit comments

Comments
 (0)