Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Automatically transform special characters in test name to avoid file overwrite in results folder (e.g. video recording) #23386

Closed
xsjcTony opened this issue May 31, 2023 · 2 comments · Fixed by #23414
Assignees
Labels

Comments

@xsjcTony
Copy link

xsjcTony commented May 31, 2023

Consider the following test

test.describe('this is a test suite', () => {
  // these are all `**-a-b-**` ❌
  test('a > b', async () => { expect(1).toBe(1); });
  test('a = b', async () => { expect(1).toBe(1); });
  test('a < b', async () => { expect(1).toBe(1); });
  test('a + b', async () => { expect(1).toBe(1); });
  test('a # b', async () => { expect(1).toBe(1); });

  // this will result in `**-a---b-**` ✅
  test('a - b', async () => { expect(1).toBe(1); });

  // this will result in `**-a-test-b-**` ✅
  test('a test b', async () => { expect(1).toBe(1); });
)}

For the first 5 tests, the video recorded for earlier ones will be overwritten by the latest one, since the folder name all resolves to **-a-b-** that those special characters got ignored. I don't think it's developer's responsibility to make test name fs.safe, since it makes sense to use special characters like > or < to replace greater than or smaller than, etc.

image

image

@pavelfeldman
Copy link
Member

Unfortunately fixing this will break existing users.

@xsjcTony
Copy link
Author

:( Fine, it makes sense. But I think it could be better if this could be mentioned explicitly in the doc so others won't fall into the trap

Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment