fix: tests

This commit is contained in:
Valerio Ageno
2024-05-01 20:03:25 +02:00
parent a87269808f
commit 2dcd0d4c5e
7 changed files with 10 additions and 9 deletions
+1
View File
@@ -1 +1,2 @@
dist/
tests/snapshots
+2 -1
View File
@@ -44,8 +44,9 @@
"@babel/types": "^7.24.0",
"@tanstack/config": "^0.7.0",
"@types/babel__core": "^7.20.5",
"@types/node": "^20.12.7",
"@vitejs/plugin-react": "^4.2.1",
"router-generator": "workspace:*",
"router-generator": "workspace:*",
"vite": "^5.2.10",
"vitest": "^1.5.2"
},
+1 -1
View File
@@ -99,7 +99,7 @@ export const splitFile = async ({
code,
compile,
filename,
}: SplitFileFnArgs): Promise<void> => {
}: SplitFileFnArgs): Promise<CompileOutput> => {
console.log('Split file [splitFile fn]', code)
return compile({
code,
+1 -2
View File
@@ -4,7 +4,7 @@ import { expect, test } from 'vitest'
import { makeCompile, splitFile } from '../src/compiler'
import { SPLIT_PREFIX } from '../src/constants'
async function splitTestFile(opts: { file: string }): void {
async function splitTestFile(opts: { file: string }): Promise<void> {
const code = (
await readFile(path.resolve(__dirname, `./test-files/${opts.file}`))
).toString()
@@ -28,7 +28,6 @@ test('it compiles and splits', async (): Promise<void> => {
// get the list of files from the /test-files directory
const files = await readdir(path.resolve(__dirname, './test-files'))
for (const file of files) {
console.log('Testing:', file)
await splitTestFile({ file })
}
})
@@ -1,3 +1,3 @@
export default function Route(): JSX.Element {
return <h1>Test route</h1>
return <h1>Test route</h1>;
}
@@ -1,4 +1,4 @@
function PostsRoute() {
return <h1>Post route</h1>
return <h1>Post route</h1>;
}
export default PostsRoute
export default PostsRoute;
@@ -1,2 +1,2 @@
import { ImportedRoute } from '../shared/imported'
export default ImportedRoute
import { ImportedRoute } from '../shared/imported';
export default ImportedRoute;