-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): use resolvedUrls from devserver (#5289)
Co-authored-by: Hiroshi Ogawa <[email protected]>
- Loading branch information
1 parent
bdc371e
commit 2fef5a7
Showing
7 changed files
with
74 additions
and
3 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { expect, test } from "vitest"; | ||
|
||
test("basic", () => { | ||
expect(1).toBe(1); | ||
}) |
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 { defineConfig } from 'vitest/config' | ||
import basicSsl from '@vitejs/plugin-basic-ssl' | ||
|
||
// test https by | ||
// TEST_HTTPS=1 pnpm test --root fixtures/server-url --api | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
!!process.env.TEST_HTTPS && basicSsl(), | ||
], | ||
}) |
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,12 @@ | ||
{ | ||
"name": "@vitest/test-ws-api", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"test": "vitest" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-basic-ssl": "^1.0.2", | ||
"vitest": "workspace:*" | ||
} | ||
} |
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,20 @@ | ||
import { join } from 'node:path' | ||
import { expect, it } from 'vitest' | ||
|
||
import { runVitestCli } from '../../test-utils' | ||
|
||
it('api server-url http', async () => { | ||
delete process.env.TEST_HTTPS | ||
const { stdout } = await runVitestCli('run', '--root', join(process.cwd(), './fixtures/server-url'), '--api') | ||
expect(stdout).toContain('API started at http://localhost:51204/') | ||
expect(stdout).toContain('Test Files 1 passed') | ||
}) | ||
|
||
it('api server-url https', async () => { | ||
process.env.TEST_HTTPS = '1' | ||
const { stdout } = await runVitestCli('run', '--root', join(process.cwd(), './fixtures/server-url'), '--api') | ||
expect(stdout).toContain('API started at https://localhost:51204/') | ||
expect(stdout).toContain('Test Files 1 passed') | ||
}) | ||
|
||
it.todo('api server-url fallback if resolvedUrls is null') |
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,7 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ['tests/**/*.test.ts'], | ||
}, | ||
}) |