Fixed #5990: Arrange platform detection in tests-main.js