Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Mar 29, 2024
1 parent 4c02535 commit 289b5e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { describe, expect, it, vi } from 'vitest'

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

const __dirname = path.dirname(new URL(import.meta.url).pathname)

vi.mock('node:fs/promises', () => ({
default: {
mkdir: vi.fn(),
Expand Down Expand Up @@ -82,7 +84,7 @@ describe('createStencilConfigFile', () => {
it('should create a config file', async () => {
const options = { rootPath: '/test' }
const configPath = await createStencilConfigFile(options)
expect(configPath).toBe(path.resolve('test', '.stencil', 'test.stencil.config.ts'))
expect(configPath).toBe(path.resolve(path.join(path.sep, 'test', '.stencil', 'test.stencil.config.ts')))
expect(fs.mkdir).toHaveBeenCalledWith('/test/.stencil', { recursive: true })
expect(fs.writeFile).toHaveBeenCalledWith(configPath, [
'import type { Config } from \'@stencil/core\'\n',
Expand Down

0 comments on commit 289b5e1

Please sign in to comment.