Skip to content

Commit

Permalink
fix window paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kolodny committed Feb 26, 2024
1 parent f57bb0f commit 995b448
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
13 changes: 1 addition & 12 deletions examples/angular-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,14 @@ import { AppModule, HelloWorldModule } from './app/app.module';

import { bootstrap } from 'safetest/ng';

const importer = (s: string) => import(`./${s}.module`);
const importer2 = (s: string) => import(`./${s}.safetest`);

// (window as any).render = render;
(window as any).importer = importer;
(window as any).importer2 = importer2;

// TestBed.configureTestingModule({
// declarations: [],
// });

const webpackContext = import.meta.webpackContext('.', {
recursive: true,
regExp: /\.safetest$/,
mode: 'lazy',
});

const keys = webpackContext.keys();
webpackContext.keys = () => keys.filter((k) => k.startsWith('./'));
webpackContext.keys = () => keys.filter((k) => k.startsWith('.'));

bootstrap({
platformBrowserDynamic,
Expand Down
2 changes: 1 addition & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export async function render(
const filenameWithoutExt = filename.split('.').slice(0, -1).join('.');
let relative = path.relative(bootstrapDir, filenameWithoutExt);
if (!relative.startsWith('.')) relative = `./${relative}`;
return relative;
return relative.replace(/\\/g, '/');
};

const attempt = getRetryAttempt();
Expand Down

0 comments on commit 995b448

Please sign in to comment.