fix: tap parser fails when test name includes non ASCII characters
fixes: #45706 (closed)
fix: tap parser fails when test name includes non ASCII characters
check for non-ascii characters and return true
if it is not.
function to check for non-ASCII characters:
#isNonASCIISymbol(char) {
const ascii = /^[ -~]+$/;
return !ascii.test(char);
}
Example:
Testing:
// test.mjs
import { it } from 'node:test'
it('नमस्ते', () => {});
Output:
TAP version 13
# Subtest: /Users/pulkitgupta/Desktop/node/test.mjs
# Subtest: नमस्ते
ok 1 - नमस्ते
# duration_ms:
ok 1 - /Users/pulkitgupta/Desktop/node/test.mjs
---
duration_ms: 59.161084
...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 61.073625
pulkitgupta@Pulkits-MacBook-Air node %