-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch option observer tests to jest
- Loading branch information
Showing
21 changed files
with
20,852 additions
and
13,583 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode" | ||
"esbenp.prettier-vscode", | ||
"orta.vscode-jest" | ||
] | ||
} |
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 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { getFakeVsCode } from '../test/unitTests/testAssets/fakes'; | ||
import * as vscodeAdapter from '../src/vscodeAdapter'; | ||
|
||
// This module creates a manual mock for the vscode module for running in unit tests. | ||
// Jest will automatically pick this up as it is in the __mocks__ directory next to node_modules. | ||
|
||
// We can consider switching to an actual jest mock (instead of this manual fake) once we entirely | ||
// remove the old test framework (mocha/chai). | ||
const vscode: vscodeAdapter.vscode = getFakeVsCode(); | ||
module.exports = vscode; |
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 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import type { Config } from 'jest'; | ||
|
||
const config: Config = { | ||
verbose: true, | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
transformIgnorePatterns: ['/dist/.+\\.js'], | ||
modulePathIgnorePatterns: ['out'], | ||
/* Specify jest to only run tests in jestUnitTests. | ||
* We also have to include the __mocks__ folder. That folder must be next to node_modules so we can't move it, | ||
* but if we specify roots, jest won't automatically pick it up. So we have to specify it here. | ||
*/ | ||
roots: ['<rootDir>/test/jestUnitTests', '<rootDir>/__mocks__'], | ||
}; | ||
|
||
export default config; |
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
Oops, something went wrong.