Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch test runner from Jest to Vitest (#1609)
* Initial work to switch from Jest to Vitest * Fix for tsconfig.test.json to satisfy picocolors import * Enable Vitest globals and remove imports for Vitest * Undo formatting changes to files that didn't need touched * Fix issue with test-types task by including Vitest global types * Fix coverage tests by adding @vitest/coverage-istanbul * Add lcov recorder for test coverage * Remove Jest config * Add text reporter so CLI still reports coverage amounts * Move Vite config to Solid package * Split include into include/exclude paths * Switch to c8 instead of istanbul for coverage * Create twenty-jobs-study.md --------- Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
- Loading branch information
1 parent
220a289
commit 620c763
Showing
27 changed files
with
1,359 additions
and
1,930 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"solid-js": patch | ||
"test-integration": patch | ||
--- | ||
|
||
Switch test runner from Jest to Vitest |
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 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
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
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,40 +1,44 @@ | ||
/** @jest-environment jsdom */ | ||
/** @vitest-environment jsdom */ | ||
import { cancelCallback, requestCallback } from "../src"; | ||
import "./MessageChannel"; | ||
|
||
describe("requestCallback basics", () => { | ||
test("queue a task", done => { | ||
requestCallback(() => { | ||
done(); | ||
}); | ||
}); | ||
test("queue a task", () => | ||
new Promise(done => { | ||
requestCallback(() => { | ||
done(undefined); | ||
}); | ||
})); | ||
|
||
test("queue a task in correct order", done => { | ||
let count = 0; | ||
requestCallback(() => { | ||
expect(count).toBe(2); | ||
done(); | ||
}); | ||
requestCallback( | ||
() => { | ||
count++; | ||
expect(count).toBe(1); | ||
}, | ||
{ timeout: 10 } | ||
); | ||
requestCallback( | ||
() => { | ||
count++; | ||
test("queue a task in correct order", () => | ||
new Promise(done => { | ||
let count = 0; | ||
requestCallback(() => { | ||
expect(count).toBe(2); | ||
}, | ||
{ timeout: 40 } | ||
); | ||
}); | ||
|
||
test("supports cancelling a callback", done => { | ||
const task = requestCallback(() => { done(new Error('should not be called')) }); | ||
cancelCallback(task); | ||
requestCallback(done); | ||
}); | ||
done(undefined); | ||
}); | ||
requestCallback( | ||
() => { | ||
count++; | ||
expect(count).toBe(1); | ||
}, | ||
{ timeout: 10 } | ||
); | ||
requestCallback( | ||
() => { | ||
count++; | ||
expect(count).toBe(2); | ||
}, | ||
{ timeout: 40 } | ||
); | ||
})); | ||
|
||
test("supports cancelling a callback", () => | ||
new Promise((done, reject) => { | ||
const task = requestCallback(() => { | ||
reject(new Error("should not be called")); | ||
}); | ||
cancelCallback(task); | ||
requestCallback(() => done(undefined)); | ||
})); | ||
}); |
Oops, something went wrong.