Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,19 @@ export function createSupportsHyperlinks(stream) {
return true;
}

// eslint-disable-next-line no-mixed-operators
// eslint-disable-next-line @stylistic/no-mixed-operators
return version.major > 1 || version.major === 1 && version.minor >= 72;
}

case 'ghostty': {
return true;
}
// No default

case 'zed': {
Comment thread
kjanat marked this conversation as resolved.
return true;
}

// No default
Comment thread
kjanat marked this conversation as resolved.
}
}

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"node": ">=20"
},
"scripts": {
"test": "xo && ava && tsc index.d.ts"
"test": "xo && ava && tsc index.d.ts",
"lint": "xo",
"lint:fix": "xo --fix"
},
"files": [
"index.js",
Expand All @@ -36,12 +38,12 @@
],
"dependencies": {
"has-flag": "^5.0.1",
"supports-color": "^10.0.0"
"supports-color": "^10.2.2"
},
"devDependencies": {
"ava": "^6.2.0",
"ava": "^6.4.1",
"codecov": "^3.8.3",
"typescript": "^5.8.2",
"xo": "^0.60.0"
"typescript": "^5.9.3",
"xo": "^1.2.3"
}
}
97 changes: 53 additions & 44 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,67 +30,57 @@ const isSupported = ({
};

test('supported iTerm.app 3.1, tty stream', t => {
t.true(isSupported(
{
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.1.0',
},
stream: {
isTTY: true,
},
t.true(isSupported({
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.1.0',
},
stream: {
isTTY: true,
},
));
}));
});

test('supported iTerm.app 3.1, no stream supplied', t => {
t.true(isSupported(
{
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.1.0',
},
t.true(isSupported({
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.1.0',
},
));
}));
});

test('supported iTerm.app 4.0, no stream supplied', t => {
t.true(isSupported(
{
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '4.0.0',
},
t.true(isSupported({
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '4.0.0',
},
));
}));
});

test('not supported iTerm 3.0, tty stream', t => {
t.false(isSupported(
{
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.0.0',
},
stream: {
isTTY: true,
},
t.false(isSupported({
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.0.0',
},
));
stream: {
isTTY: true,
},
}));
});

test('not supported iTerm 3.1, non-tty stream', t => {
t.false(isSupported(
{
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.1.0',
},
stream: {
isTTY: false,
},
t.false(isSupported({
env: {
TERM_PROGRAM: 'iTerm.app',
TERM_PROGRAM_VERSION: '3.1.0',
},
));
stream: {
isTTY: false,
},
}));
});

test('not supported WezTerm 20200620 no stream supplied', t => {
Expand Down Expand Up @@ -349,6 +339,25 @@ test('supported in kitty', t => {
}));
});

test('supported zed no stream supplied', t => {
t.true(isSupported({
env: {
TERM_PROGRAM: 'zed',
Comment thread
kjanat marked this conversation as resolved.
},
}));
});

test('supported zed tty stream', t => {
t.true(isSupported({
env: {
TERM_PROGRAM: 'zed',
Comment thread
kjanat marked this conversation as resolved.
},
stream: {
isTTY: true,
},
}));
});

test('empty env not supported', t => {
t.false(isSupported({env: {}}));
});
Expand Down
Loading