15 lines
961 B
TypeScript
15 lines
961 B
TypeScript
import { expect, test } from 'bun:test';
|
|
import { newer, runner } from '../cli/lib/self-update';
|
|
|
|
test('npx / bunx caches are swapped for the newest version, a project install only gets a note', () => {
|
|
expect(runner('/Users/you/.npm/_npx/1a2b/node_modules/storebound/dist/storebound.mjs')).toBe('npx');
|
|
expect(runner('C:\\Users\\x\\AppData\\Local\\npm-cache\\_npx\\1a2b\\node_modules\\storebound\\dist\\storebound.mjs')).toBe('npx');
|
|
expect(runner('/Users/you/.bun/install/cache/storebound@0.8.12@@@1/dist/storebound.mjs')).toBe('bunx');
|
|
expect(runner('/Users/you/app/node_modules/storebound/dist/storebound.mjs')).toBe('project');
|
|
expect(runner('/Users/you/storebound/cli/index.ts')).toBe('other');
|
|
expect(newer('0.8.13', '0.8.12')).toBe(true);
|
|
expect(newer('0.8.12', '0.8.12')).toBe(false);
|
|
expect(newer('0.9.0', '0.8.99')).toBe(true);
|
|
expect(newer('0.8.12', '0.8.13')).toBe(false);
|
|
expect(newer('0.8.12', '0.8.12-rc.1')).toBe(true);
|
|
});
|