From 3598b4450fb4c0848bec449d6d40565560b85006 Mon Sep 17 00:00:00 2001 From: Miki Date: Thu, 20 Oct 2022 10:41:11 -0700 Subject: [PATCH] [@osd/plugin-generator] Standardize paths in tests Signed-off-by: Miki --- .../src/integration_tests/generate_plugin.test.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/osd-plugin-generator/src/integration_tests/generate_plugin.test.ts b/packages/osd-plugin-generator/src/integration_tests/generate_plugin.test.ts index 51378b14470d..727f2a44defd 100644 --- a/packages/osd-plugin-generator/src/integration_tests/generate_plugin.test.ts +++ b/packages/osd-plugin-generator/src/integration_tests/generate_plugin.test.ts @@ -32,13 +32,18 @@ import Path from 'path'; import del from 'del'; import execa from 'execa'; -import { REPO_ROOT } from '@osd/utils'; +import { REPO_ROOT, standardize } from '@osd/utils'; import { createAbsolutePathSerializer } from '@osd/dev-utils'; import globby from 'globby'; -const GENERATED_DIR = Path.resolve(REPO_ROOT, `plugins`); +// Has to be a posix reference because it is used to generate glob patterns +const GENERATED_DIR = standardize(Path.resolve(REPO_ROOT, `plugins`), true); -expect.addSnapshotSerializer(createAbsolutePathSerializer()); +expect.addSnapshotSerializer( + createAbsolutePathSerializer( + process?.platform === 'win32' ? standardize(REPO_ROOT, true) : REPO_ROOT + ) +); beforeEach(async () => { await del([`${GENERATED_DIR}/**`, `!${GENERATED_DIR}`, `!${GENERATED_DIR}/.gitignore`], {