Skip to content

Commit

Permalink
Try enable more tests in Bun
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 28, 2024
1 parent 4d8b35b commit d31fef8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
5 changes: 1 addition & 4 deletions packages/knip/test/cli/cli-preprocessor.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { test } from 'bun:test';
import assert from 'node:assert/strict';
import os from 'node:os';
import { resolve } from '../../src/util/path.js';
import { execFactory } from '../helpers/exec.js';

const skipIf = typeof Bun !== 'undefined' && os.platform() === 'win32' ? test.skip : test;

const cwd = resolve('fixtures/cli-preprocessor');

const exec = execFactory(cwd);
Expand All @@ -30,7 +27,7 @@ test('knip --preprocessor @org/preprocessor', () => {
assert.equal(stdout, 'hi from scoped preprocessor');
});

skipIf(`knip --preprocessor with-args --preprocessor-options {"food":"cupcake"}`, () => {
test(`knip --preprocessor with-args --preprocessor-options {"food":"cupcake"}`, () => {
const { stdout } = exec(`knip --preprocessor with-args --preprocessor-options {\\"food\\":\\"cupcake\\"}`);
assert.equal(stdout, 'hi from with-args preprocessor, you gave me: cupcake');
});
5 changes: 1 addition & 4 deletions packages/knip/test/plugins/lefthook-v1.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { test } from 'bun:test';
import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import os from 'node:os';
import { main } from '../../src/index.js';
import { join, resolve } from '../../src/util/path.js';
import baseArguments from '../helpers/baseArguments.js';
import baseCounters from '../helpers/baseCounters.js';

const skipIf = typeof Bun !== 'undefined' && os.platform() === 'win32' ? test.skip : test;

const cwd = resolve('fixtures/plugins/lefthook-v1');

skipIf('Find dependencies with the lefthook v1 plugin', async () => {
test('Find dependencies with the lefthook v1 plugin', async () => {
const CI = process.env.CI;
process.env.CI = '';
await fs.rename(join(cwd, '_git'), join(cwd, '.git')); // Can't add .git folder to repo
Expand Down
4 changes: 1 addition & 3 deletions packages/knip/test/self-reference-from-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import { resolve } from '../src/util/path.js';
import baseArguments from './helpers/baseArguments.js';
import baseCounters from './helpers/baseCounters.js';

const skipIf = typeof Bun !== 'undefined' ? test.skip : test;

const cwd = resolve('fixtures/self-reference-from-plugin');

skipIf('Allows self-references from plugin', async () => {
test('Allows self-references from plugin', async () => {
const { counters } = await main({
...baseArguments,
cwd,
Expand Down

0 comments on commit d31fef8

Please sign in to comment.