Skip to content

Commit b3e2b48

Browse files
committed
Address ts import error by changing test from .ts to .mjs
1 parent 542636d commit b3e2b48

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"test": "jest --no-watchman",
4444
"test-fed-compat": "ts-node --transpileOnly --compiler-options='{\"module\":\"commonjs\"}' scripts/fetch-federation-tests && yarn test federation-compat",
4545
"test:leaks": "cross-env \"LEAK_TEST=1\" jest --no-watchman --detectOpenHandles --detectLeaks --logHeapUsage",
46-
"test:node": "node --experimental-strip-types --test **/tests/**/*.node.ts",
46+
"test:node": "node --experimental-strip-types --test **/tests/**/*.node.*s",
4747
"ts:check": "tsc --noEmit"
4848
},
4949
"devDependencies": {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import assert from 'node:assert';
2+
import { describe, it } from 'node:test';
3+
import { useCustomLoader, useCustomLoaderSync } from '../src/utils/custom-loader.ts';
4+
5+
describe('useCustomLoader', () => {
6+
it('can load a custom cjs loader from a file path', async () => {
7+
const loader = await useCustomLoader(`./custom-loader.cjs`, import.meta.dirname);
8+
const result = await loader('some-name', { customLoaderContext: {} });
9+
assert.strictEqual(result, 'I like turtles');
10+
});
11+
12+
it('can load a custom cjs loader synchronously', async () => {
13+
const loader = useCustomLoaderSync(`./custom-loader.cjs`, import.meta.dirname);
14+
const result = await loader('some-name', { customLoaderContext: {} });
15+
assert.strictEqual(result, 'I like turtles');
16+
});
17+
18+
it('can load a custom mjs loader from a file path', async () => {
19+
const loader = await useCustomLoader(`./custom-loader.mjs`, import.meta.dirname);
20+
const result = await loader('some-name', { customLoaderContext: {} });
21+
assert.strictEqual(result, 'I like turtles');
22+
});
23+
});

0 commit comments

Comments
 (0)