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 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" : {
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