11import { describe , it , expect } from 'vitest'
2- import { join } from 'path'
2+ import { join , dirname } from 'path'
3+ import { fileURLToPath } from 'url'
34import { createRequire } from 'module'
45
56/**
@@ -9,6 +10,8 @@ import { createRequire } from 'module'
910 */
1011
1112const require = createRequire ( import . meta. url )
13+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
14+ const projectRoot = join ( __dirname , '..' , '..' , '..' )
1215
1316function createMockResult ( overrides : Record < string , unknown > = { } ) {
1417 return {
@@ -51,7 +54,7 @@ function createCleanResult() {
5154}
5255
5356describe ( 'Formatter Output' , ( ) => {
54- const formatterPath = join ( process . cwd ( ) , 'dist/linter/eslint-plugin/formatter.js' )
57+ const formatterPath = join ( projectRoot , 'dist/linter/eslint-plugin/formatter.js' )
5558 const formatterModule = require ( formatterPath )
5659
5760 describe ( 'default formatter' , ( ) => {
@@ -102,7 +105,7 @@ describe('Formatter Output', () => {
102105} )
103106
104107describe ( 'Formatter With Progress Output' , ( ) => {
105- const formatterPath = join ( process . cwd ( ) , 'dist/linter/eslint-plugin/formatter-with-progress.js' )
108+ const formatterPath = join ( projectRoot , 'dist/linter/eslint-plugin/formatter-with-progress.js' )
106109 const formatterModule = require ( formatterPath )
107110
108111 describe ( 'progress formatter' , ( ) => {
0 commit comments