File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 43
43
"test" : " jest --no-watchman" ,
44
44
"test-fed-compat" : " ts-node --transpileOnly --compiler-options='{\" module\" :\" commonjs\" }' scripts/fetch-federation-tests && yarn test federation-compat" ,
45
45
"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 " ,
47
47
"ts:check" : " tsc --noEmit"
48
48
},
49
49
"devDependencies" : {
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments