|
1 | 1 | import path from 'path' |
2 | 2 | import { describe, expect, it } from 'vitest' |
3 | 3 | import { relative, wordWrap } from './renderer' |
| 4 | +import { normalizeWindowsSeperators } from './test-helpers' |
4 | 5 |
|
5 | 6 | describe('relative', () => { |
6 | 7 | it('should print an absolute path relative to the current working directory', () => { |
7 | | - expect(relative(path.resolve('index.css'))).toMatchInlineSnapshot(`"./index.css"`) |
| 8 | + expect(normalizeWindowsSeperators(relative(path.resolve('index.css')))).toMatchInlineSnapshot( |
| 9 | + `"./index.css"`, |
| 10 | + ) |
8 | 11 | }) |
9 | 12 |
|
10 | 13 | it('should prefer the shortest value by default', () => { |
11 | 14 | // Shortest between absolute and relative paths |
12 | | - expect(relative('index.css')).toMatchInlineSnapshot(`"index.css"`) |
| 15 | + expect(normalizeWindowsSeperators(relative('index.css'))).toMatchInlineSnapshot(`"index.css"`) |
13 | 16 | }) |
14 | 17 |
|
15 | 18 | it('should be possible to override the current working directory', () => { |
16 | | - expect(relative('../utils/index.css', '..')).toMatchInlineSnapshot(`"./utils/index.css"`) |
| 19 | + expect(normalizeWindowsSeperators(relative('../utils/index.css', '..'))).toMatchInlineSnapshot( |
| 20 | + `"./utils/index.css"`, |
| 21 | + ) |
17 | 22 | }) |
18 | 23 |
|
19 | 24 | it('should be possible to always prefer the relative path', () => { |
20 | 25 | expect( |
21 | | - relative('index.css', process.cwd(), { preferAbsoluteIfShorter: false }), |
| 26 | + normalizeWindowsSeperators( |
| 27 | + relative('index.css', process.cwd(), { preferAbsoluteIfShorter: false }), |
| 28 | + ), |
22 | 29 | ).toMatchInlineSnapshot(`"./index.css"`) |
23 | 30 | }) |
24 | 31 | }) |
|
0 commit comments