Skip to content

Commit eef395a

Browse files
committed
Tweaks test paths to work on windows
1 parent f4f7d0c commit eef395a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/analyzer/test/integration.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { test } from 'uvu';
22
import * as assert from 'uvu/assert';
33
import path from 'path';
4+
import { pathToFileURL } from 'url';
45
import fs from 'fs';
56
import globby from 'globby';
67
import ts from 'typescript';
@@ -27,13 +28,14 @@ testCases.forEach(testCase => {
2728
const fixture = JSON.parse(fs.readFileSync(fixturePath, 'utf-8'));
2829

2930
const packagePath = path.join(fixturesDir, `${testCase}/package`);
31+
const packagePathPosix = packagePath.split(path.sep).join(path.posix.sep);
3032
const outputPath = path.join(fixturesDir, `${testCase}/output.json`);
3133

32-
const globs = await globby(packagePath);
34+
const globs = await globby(packagePathPosix);
3335
const modules = globs
3436
.filter(path => !path.includes('custom-elements-manifest.config.js'))
3537
.map(glob => {
36-
const relativeModulePath = `./${path.relative(process.cwd(), glob)}`;
38+
const relativeModulePath = `.${path.sep}${path.relative(process.cwd(), glob)}`;
3739
const source = fs.readFileSync(relativeModulePath).toString();
3840

3941
return ts.createSourceFile(
@@ -45,8 +47,9 @@ testCases.forEach(testCase => {
4547
});
4648

4749
let plugins = [];
50+
const manifestPathFileURL = pathToFileURL(`${packagePath}/custom-elements-manifest.config.js`).href;
4851
try {
49-
const config = await import(`${packagePath}/custom-elements-manifest.config.js`);
52+
const config = await import(manifestPathFileURL);
5053
plugins = [...config.default.plugins];
5154
} catch {}
5255

0 commit comments

Comments
 (0)