-
-
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.
- Loading branch information
1 parent
c1c8c17
commit 9f69ec8
Showing
14 changed files
with
214 additions
and
109 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 @@ | ||
results.json |
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,17 @@ | ||
import { readFile } from 'node:fs/promises' | ||
import assert from 'node:assert/strict' | ||
|
||
export async function teardown() { | ||
const results = JSON.parse(await readFile('./results.json', 'utf-8')) | ||
|
||
try { | ||
assert.ok(results.success) | ||
assert.equal(results.numTotalTestSuites, 3) | ||
assert.equal(results.numTotalTests, 3) | ||
assert.equal(results.numPassedTests, 3) | ||
} | ||
catch (err) { | ||
console.error(err) | ||
process.exit(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,12 @@ | ||
{ | ||
"name": "@vitest/test-workspaces", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"test": "vitest run" | ||
}, | ||
"devDependencies": { | ||
"@vitest/browser": "workspace:^", | ||
"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,6 @@ | ||
import { expect, test } from 'vitest' | ||
import { sum } from '../../src/math' | ||
|
||
test('3 + 3 = 6', () => { | ||
expect(sum(3, 3)).toBe(6) | ||
}) |
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('window is undefined', () => { | ||
expect(globalThis.window).toBeUndefined() | ||
}) |
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 { defineProject } from 'vitest/config' | ||
|
||
export default defineProject({ | ||
test: { | ||
name: 'space_1', | ||
}, | ||
}) |
8 changes: 8 additions & 0 deletions
8
test/workspaces-browser/space_1/vitest.config.ts.timestamp-4345324-324424.mjs
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,8 @@ | ||
import { defineProject } from 'vitest/config' | ||
|
||
export default defineProject({ | ||
test: { | ||
name: 'space_1', | ||
environment: 'happy-dom', | ||
}, | ||
}) |
File renamed without changes.
File renamed without changes.
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,14 @@ | ||
/* eslint-disable unused-imports/no-unused-vars */ | ||
export function sum(a: number, b: number) { | ||
if (a === 3 && b === 4) { | ||
// This should be uncovered | ||
return 7 | ||
} | ||
|
||
return a + b | ||
} | ||
|
||
function uncoveredFunction() { | ||
// This should be uncovered | ||
return 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,15 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
if (process.env.TEST_WATCH) { | ||
// Patch stdin on the process so that we can fake it to seem like a real interactive terminal and pass the TTY checks | ||
process.stdin.isTTY = true | ||
process.stdin.setRawMode = () => process.stdin | ||
} | ||
|
||
export default defineConfig({ | ||
test: { | ||
reporters: ['default', 'json'], | ||
outputFile: './results.json', | ||
globalSetup: './globalTest.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineWorkspace } from 'vitest/config' | ||
|
||
export default defineWorkspace([ | ||
'./space_*/*.config.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