@@ -8,8 +8,7 @@ import { fileURLToPath } from 'node:url';
88const __filename = fileURLToPath ( import . meta. url ) ;
99const __dirname = dirname ( __filename ) ;
1010const root = join ( __dirname , '..' ) ;
11- const libCjs = join ( root , 'lib/cjs' ) ;
12- const libEsm = join ( root , 'lib/esm' ) ;
11+ const lib = join ( root , 'lib' ) ;
1312const tmp = mkdtempSync ( join ( os . tmpdir ( ) , 'workos-test-' ) ) ;
1413
1514// Map of "runtime label" → { cmd, args }
@@ -18,35 +17,35 @@ const tests: Record<string, { cmd: string; args: string[] }> = {
1817 cmd : 'node' ,
1918 args : [
2019 '-e' ,
21- `console.log('✅ Node CJS:', require("${ libCjs } /index.cjs").WorkOS.name)` ,
20+ `console.log('✅ Node CJS:', require("${ lib } /index.cjs").WorkOS.name)` ,
2221 ] ,
2322 } ,
2423 'node-esm' : {
2524 cmd : 'node' ,
2625 args : [
2726 '-e' ,
28- `import("${ libEsm } /index.js").then(m => console.log('✅ Node ESM:', m.WorkOS.name))` ,
27+ `import("${ lib } /index.js").then(m => console.log('✅ Node ESM:', m.WorkOS.name))` ,
2928 ] ,
3029 } ,
3130 deno : {
3231 cmd : 'deno' ,
3332 args : [
3433 'eval' ,
35- `import("${ libEsm } /index.js").then(m => console.log('✅ Deno:', m.WorkOS.name))` ,
34+ `import("${ lib } /index.js").then(m => console.log('✅ Deno:', m.WorkOS.name))` ,
3635 ] ,
3736 } ,
3837 'bun-cjs' : {
3938 cmd : 'bun' ,
4039 args : [
4140 '-e' ,
42- `console.log('✅ Bun CJS:', require("${ libCjs } /index.cjs").WorkOS.name)` ,
41+ `console.log('✅ Bun CJS:', require("${ lib } /index.cjs").WorkOS.name)` ,
4342 ] ,
4443 } ,
4544 'bun-esm' : {
4645 cmd : 'bun' ,
4746 args : [
4847 '-e' ,
49- `import("${ libEsm } /index.js").then(m => console.log('✅ Bun ESM:', m.WorkOS.name))` ,
48+ `import("${ lib } /index.js").then(m => console.log('✅ Bun ESM:', m.WorkOS.name))` ,
5049 ] ,
5150 } ,
5251} ;
@@ -91,10 +90,10 @@ if (miniflareCheck.status !== 0) {
9190} else {
9291 // 2. Create the temporary worker script
9392 const workerScriptPath = join ( tmp , 'worker-test.js' ) ;
94- const safeLibEsmPath = libEsm . replace ( / \\ / g, '\\\\' ) ; // For Windows compatibility
93+ const safeLibPath = lib . replace ( / \\ / g, '\\\\' ) ; // For Windows compatibility
9594
9695 const workerScriptContent = `
97- import { WorkOS } from '${ safeLibEsmPath } /index.js';
96+ import { WorkOS } from '${ safeLibPath } /index.worker .js';
9897
9998if (WorkOS && WorkOS.name === 'WorkOS') {
10099 console.log('✅ Worker (miniflare): SDK imported successfully.');
0 commit comments