-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f98d5d
commit fcc52d3
Showing
14 changed files
with
101 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import path from 'path'; | ||
import { setupNuxtE2ETestForConfig } from './setupNuxtE2ETestForConfig'; | ||
import { globby } from 'globby'; | ||
|
||
describe.sequential('Testing E2E with different configs', async () => { | ||
try { | ||
const allConfigs = await globby('test/samples-config'); | ||
for (let config of allConfigs) { | ||
const configFileName = path.parse(config).name; | ||
await setupNuxtE2ETestForConfig(configFileName); | ||
} | ||
} catch (e: any) { | ||
throw new Error(e); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
42 changes: 22 additions & 20 deletions
42
test/e2e/sample-project/utils.ts → test/e2e/setupNuxtE2ETestForConfig.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<template> | ||
<span>Foo</span> | ||
<span>404</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Each file will be isolated type wise, so the e2e tests will navigate to the corresponding route |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { timeout } from '$$/utils'; | ||
import { $ } from 'zx'; | ||
|
||
export async function setupNuxtTestWithConfig(configName: string) { | ||
try { | ||
await $`NUXT_ROUTER_CONFIG_NAME=${configName} pnpm run test:types-fixtures`; | ||
await timeout(100); | ||
} catch (e) { | ||
return Promise.reject(`Typecheck failed for config: [${configName}]: ${e}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import path from 'path'; | ||
import { setupNuxtTestWithConfig } from './setupTypeTest'; | ||
import { globby } from 'globby'; | ||
|
||
describe.sequential('Testing types with different configs', async () => { | ||
try { | ||
const allConfigs = await globby('test/samples-config', { absolute: false }); | ||
for (let config of allConfigs) { | ||
const configFileName = path.parse(config).name; | ||
await setupNuxtTestWithConfig(configFileName); | ||
} | ||
} catch (e: any) { | ||
throw new Error(e); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
export * from './tsd.utils'; | ||
export * from './typecheck'; | ||
import type { NuxtConfig } from '@nuxt/schema'; | ||
import { globbySync } from 'globby'; | ||
|
||
export function timeout(count: number) { | ||
return new Promise((resolve) => setTimeout(resolve, count)); | ||
} | ||
|
||
export function getConfigFromName(configName: string, config: NuxtConfig): NuxtConfig { | ||
const files = globbySync(`test/fixtures/sample-project/tests/[${configName}]`); | ||
return { | ||
...config, | ||
nuxtTypedRouter: { | ||
...config.nuxtTypedRouter, | ||
ignoreRoutes: ['[...404].vue', '[tests]/**/*.vue'], | ||
}, | ||
typescript: { | ||
tsConfig: { | ||
files: [ | ||
...files.map((m) => m.replace('test/fixtures/sample-project', '..')), | ||
`../src/pages/[tests]/[${configName}].vue`, | ||
], | ||
exclude: ['../tests/**/*', '../src/pages/[tests]/**/*.vue'], | ||
}, | ||
}, | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters