Skip to content

Commit 683f218

Browse files
committed
test: normalize paths on Windows even if resolve.symlinks is false (#8483)
This test was passing with Rollup, but doesn't with Rolldown. Fixed by oxc-project/oxc-resolver#1036.
1 parent a828c64 commit 683f218

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import path from 'node:path';
2+
import { defineTest } from 'rolldown-tests';
3+
import { expect } from 'vitest';
4+
5+
export default defineTest({
6+
config: {
7+
input: [path.join(__dirname, './main.js').replaceAll('\\', '/')],
8+
resolve: {
9+
symlinks: false,
10+
},
11+
},
12+
afterTest(output) {
13+
function countOccurrences(str: string, substr: string) {
14+
let count = 0;
15+
let index = str.indexOf(substr);
16+
while (index !== -1) {
17+
count++;
18+
index = str.indexOf(substr, index + 1);
19+
}
20+
return count;
21+
}
22+
23+
expect(countOccurrences(output.output[0].code, 'console.log')).toBe(1);
24+
},
25+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './main.js';
2+
3+
console.log('main');

packages/rolldown/tests/fixtures/resolve/windows-normalize/main2.js

Whitespace-only changes.

0 commit comments

Comments
 (0)