Skip to content

Commit

Permalink
Add test in new workspaces fixture for 3ee0476
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 9, 2024
1 parent b6541f3 commit 4a3f84c
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const config = {
stories: ['../packages/**/src/**/*.stories.*'],
};

export default config;
3 changes: 3 additions & 0 deletions packages/knip/fixtures/workspaces-entry-files/knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json"
}
Empty file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions packages/knip/fixtures/workspaces-entry-files/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"scripts": {
"storybook": "storybook dev"
},
"workspaces": ["packages/*"],
"devDependencies": {
"storybook": "*",
"@storybook/react": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@monorepo/client",
"version": "0.0.0",
"private": true,
"type": "module",
"main": "src/index.ts",
"dependencies": {
"@monorepo/shared": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Meta, StoryObj } from '@storybook/react';

export default {
title: 'test'
} as Meta;

export const _default: StoryObj = {
render: () => null
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { sharedFunction } from '@monorepo/shared';

sharedFunction();
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist",
"rootDir": "src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["dist/**/*"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@monorepo/shared",
"version": "0.0.0",
"private": true,
"type": "module",
"main": "src/index.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const sharedFunction = () => {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist",
"rootDir": "src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["dist/**/*"]
}
21 changes: 21 additions & 0 deletions packages/knip/test/workspaces-entry-files.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { main } from '../src/index.js';
import { resolve } from '../src/util/path.js';
import baseArguments from './helpers/baseArguments.js';
import baseCounters from './helpers/baseCounters.js';

const cwd = resolve('fixtures/workspaces-entry-files');

test('Use root plugin config in workspaces', async () => {
const { counters } = await main({
...baseArguments,
cwd,
});

assert.deepEqual(counters, {
...baseCounters,
total: 4,
processed: 4,
});
});

0 comments on commit 4a3f84c

Please sign in to comment.