Skip to content

Commit 289b5e1

Browse files
fix unit test
1 parent 4c02535 commit 289b5e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/utils.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { describe, expect, it, vi } from 'vitest'
44

55
import { createStencilConfigFile, getCompilerOptions, getRootDir, injectStencilImports } from '../src/utils'
66

7+
const __dirname = path.dirname(new URL(import.meta.url).pathname)
8+
79
vi.mock('node:fs/promises', () => ({
810
default: {
911
mkdir: vi.fn(),
@@ -82,7 +84,7 @@ describe('createStencilConfigFile', () => {
8284
it('should create a config file', async () => {
8385
const options = { rootPath: '/test' }
8486
const configPath = await createStencilConfigFile(options)
85-
expect(configPath).toBe(path.resolve('test', '.stencil', 'test.stencil.config.ts'))
87+
expect(configPath).toBe(path.resolve(path.join(path.sep, 'test', '.stencil', 'test.stencil.config.ts')))
8688
expect(fs.mkdir).toHaveBeenCalledWith('/test/.stencil', { recursive: true })
8789
expect(fs.writeFile).toHaveBeenCalledWith(configPath, [
8890
'import type { Config } from \'@stencil/core\'\n',

0 commit comments

Comments
 (0)