Skip to content

Commit 2837b25

Browse files
committed
Remove leading forward slash from test names
1 parent 0f065ec commit 2837b25

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/rtk-codemods/transformTestUtils.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ export const runTransformTest = (
1515
describe(name, () => {
1616
globbySync('**/*.input.*', {
1717
cwd: fixturePath,
18-
absolute: true
18+
absolute: true,
19+
objectMode: true
1920
})
20-
.map((entry) => entry.slice(fixturePath.length))
21+
.map((entry) => entry.name)
2122
.forEach((filename) => {
2223
const extension = path.extname(filename)
2324
const testName = filename.replace(`.input${extension}`, '')
@@ -31,16 +32,20 @@ export const runTransformTest = (
3132
`${testName}.output${extension}`
3233
)
3334

34-
describe(testName, () => {
35+
const inputFileContent = fs.readFileSync(inputPath, 'utf8')
36+
37+
const expectedOutput = fs.readFileSync(outputPath, 'utf8')
38+
39+
describe(`${testName}${extension}`, () => {
3540
it('transforms correctly', () => {
3641
runInlineTest(
3742
transform,
3843
{},
3944
{
4045
path: testInputPath,
41-
source: fs.readFileSync(inputPath, 'utf8')
46+
source: inputFileContent
4247
},
43-
fs.readFileSync(outputPath, 'utf8'),
48+
expectedOutput,
4449
{ parser }
4550
)
4651
})
@@ -51,9 +56,9 @@ export const runTransformTest = (
5156
{},
5257
{
5358
path: testInputPath,
54-
source: fs.readFileSync(outputPath, 'utf8')
59+
source: inputFileContent
5560
},
56-
fs.readFileSync(outputPath, 'utf8'),
61+
expectedOutput,
5762
{ parser }
5863
)
5964
})

0 commit comments

Comments
 (0)