1
1
import { test } from 'uvu' ;
2
2
import * as assert from 'uvu/assert' ;
3
3
import path from 'path' ;
4
+ import { pathToFileURL } from 'url' ;
4
5
import fs from 'fs' ;
5
6
import globby from 'globby' ;
6
7
import ts from 'typescript' ;
@@ -27,13 +28,14 @@ testCases.forEach(testCase => {
27
28
const fixture = JSON . parse ( fs . readFileSync ( fixturePath , 'utf-8' ) ) ;
28
29
29
30
const packagePath = path . join ( fixturesDir , `${ testCase } /package` ) ;
31
+ const packagePathPosix = packagePath . split ( path . sep ) . join ( path . posix . sep ) ;
30
32
const outputPath = path . join ( fixturesDir , `${ testCase } /output.json` ) ;
31
33
32
- const globs = await globby ( packagePath ) ;
34
+ const globs = await globby ( packagePathPosix ) ;
33
35
const modules = globs
34
36
. filter ( path => ! path . includes ( 'custom-elements-manifest.config.js' ) )
35
37
. map ( glob => {
36
- const relativeModulePath = `./ ${ path . relative ( process . cwd ( ) , glob ) } ` ;
38
+ const relativeModulePath = `.${ path . sep } ${ path . relative ( process . cwd ( ) , glob ) } ` ;
37
39
const source = fs . readFileSync ( relativeModulePath ) . toString ( ) ;
38
40
39
41
return ts . createSourceFile (
@@ -45,8 +47,9 @@ testCases.forEach(testCase => {
45
47
} ) ;
46
48
47
49
let plugins = [ ] ;
50
+ const manifestPathFileURL = pathToFileURL ( `${ packagePath } /custom-elements-manifest.config.js` ) . href ;
48
51
try {
49
- const config = await import ( ` ${ packagePath } /custom-elements-manifest.config.js` ) ;
52
+ const config = await import ( manifestPathFileURL ) ;
50
53
plugins = [ ...config . default . plugins ] ;
51
54
} catch { }
52
55
0 commit comments