Skip to content

Commit

Permalink
tests: Move tests folders (#5634)
Browse files Browse the repository at this point in the history
* refactor: Move tests folder

* Move remaining folders

* Update tanstack/config

* Fix knip

* Fix include
  • Loading branch information
lachlancollins committed Jun 29, 2024
1 parent 6a4f224 commit f159b04
Show file tree
Hide file tree
Showing 45 changed files with 233 additions and 68 deletions.
8 changes: 2 additions & 6 deletions knip.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"$schema": "https://unpkg.com/knip@4/schema.json",
"ignoreDependencies": [
"size-limit",
"@size-limit/preset-small-lib",
"@builder.io/qwik"
],
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignoreDependencies": ["@size-limit/preset-small-lib"],
"ignoreWorkspaces": ["examples/**"],
"workspaces": {
"packages/match-sorter-utils": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@size-limit/preset-small-lib": "^11.1.2",
"@tanstack/config": "^0.8.7",
"@tanstack/config": "^0.9.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.4",
"@testing-library/react-hooks": "^8.0.1",
"@types/node": "^20.12.7",
"jsdom": "^24.0.0",
"knip": "^5.10.0",
"knip": "^5.23.1",
"nx": "^19.3.0",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/angular-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"test:types": "tsc --noEmit",
"test:lib": "vitest",
"test:lib:dev": "vitest --watch",
"build": "pnpm ng-packagr -p ng-package.json && rimraf ./build/lib/package.json",
"build:types": "tsc --emitDeclarationOnly"
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./build/lib/package.json"
},
"dependencies": {
"@tanstack/table-core": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, test } from 'vitest'
import { describe, expect, test } from 'vitest'
import {
type ColumnDef,
createAngularTable,
getCoreRowModel,
type Table,
} from '../index'
} from '../src/index'
import { Component, input, isSignal, signal, untracked } from '@angular/core'
import { TestBed } from '@angular/core/testing'
import { setSignalInputs } from './test-utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
FlexRenderComponent,
FlexRenderDirective,
injectFlexRenderContext,
} from '../flex-render'
} from '../src/flex-render'
import { setFixtureSignalInput, setFixtureSignalInputs } from './test-utils'

interface Data {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, test } from 'vitest'
import { describe, expect, test, vi } from 'vitest'
import {
ChangeDetectionStrategy,
Component,
Expand All @@ -9,7 +9,7 @@ import {
signal,
} from '@angular/core'
import { TestBed } from '@angular/core/testing'
import { lazyInit } from '../lazy-signal-initializer'
import { lazyInit } from '../src/lazy-signal-initializer'
import { flushQueue, setFixtureSignalInputs } from './test-utils'

describe('lazyInit', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@analogjs/vite-plugin-angular/setup-vitest'
import '@testing-library/jest-dom/vitest'

import {
BrowserDynamicTestingModule,
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions packages/angular-table/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./node_modules/ng-packagr/lib/ts/conf/tsconfig.ngc.json",
"compilerOptions": {
"allowJs": true,
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "Bundler"
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true,
"compilationMode": "partial"
},
"include": ["src"]
}
15 changes: 2 additions & 13 deletions packages/angular-table/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./build/lib",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
Expand All @@ -12,16 +10,7 @@
"noFallthroughCasesInSwitch": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"types": ["vitest/globals"]
"importHelpers": true
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true,
"compilationMode": "partial"
},
"include": ["src/**/*.ts"],
"exclude": ["**/*.spec.ts"]
"include": ["src", "tests", "vitest.config.ts"]
}
14 changes: 6 additions & 8 deletions packages/angular-table/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { defineConfig } from 'vitest/config'
import packageJson from './package.json'

export default defineConfig(({ mode }) => ({
export default defineConfig({
test: {
name: packageJson.name,
globals: true,
setupFiles: ['src/__tests__/test-setup.ts'],
dir: './tests',
watch: false,
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
define: {
'import.meta.vitest': mode !== 'production',
setupFiles: ['./tests/test-setup.ts'],
globals: true,
},
}))
})
1 change: 0 additions & 1 deletion packages/match-sorter-utils/test-setup.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest'
import { rankings, rankItem } from '../src'

interface Person {
Expand Down
1 change: 1 addition & 0 deletions packages/match-sorter-utils/tests/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/vitest'
7 changes: 4 additions & 3 deletions packages/match-sorter-utils/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { defineConfig } from 'vitest/config'
import packageJson from './package.json'

export default defineConfig({
test: {
name: packageJson.name,
dir: './tests',
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
globals: true,
dir: '__tests__',
setupFiles: ['./tests/test-setup.ts'],
},
})
1 change: 0 additions & 1 deletion packages/react-table/test-setup.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'

import { describe, expect, it } from 'vitest'
import { act, renderHook } from '@testing-library/react-hooks'
import * as RTL from '@testing-library/react'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
ColumnDef,
flexRender,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react'

import { describe, expect, it } from 'vitest'
// import { renderHook } from '@testing-library/react-hooks'
import * as RTL from '@testing-library/react'
import '@testing-library/jest-dom'
import {
useReactTable,
getCoreRowModel,
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/react-table/tests/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/vitest'
6 changes: 4 additions & 2 deletions packages/react-table/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defineConfig } from 'vitest/config'
import packageJson from './package.json'

export default defineConfig({
test: {
name: packageJson.name,
dir: './tests',
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
setupFiles: ['./tests/test-setup.ts'],
globals: true,
dir: '__tests__',
},
})
1 change: 0 additions & 1 deletion packages/table-core/test-setup.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest'
import {
ColumnDef,
createColumnHelper,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest'
import {
ColumnDef,
createColumnHelper,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest'
import { ColumnDef, getCoreRowModel } from '../src'
import { createColumnHelper } from '../src/columnHelper'
import { createTable } from '../src/core/table'
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/table-core/tests/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/vitest'
6 changes: 4 additions & 2 deletions packages/table-core/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defineConfig } from 'vitest/config'
import packageJson from './package.json'

export default defineConfig({
test: {
name: packageJson.name,
dir: './tests',
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
setupFiles: ['./tests/test-setup.ts'],
globals: true,
dir: '__tests__',
},
})
Loading

0 comments on commit f159b04

Please sign in to comment.