-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from grafana/kevinwcyu/node-18
Support Node 18
- Loading branch information
Showing
7 changed files
with
763 additions
and
4,227 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
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 @@ | ||
18 |
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,13 +1,31 @@ | ||
// This file is needed because it is used by vscode and other tools that | ||
// call `jest` directly. However, unless you are doing anything special | ||
// do not edit this file | ||
module.exports = { | ||
modulePaths: ['<rootDir>/src'], | ||
setupFilesAfterEnv: ['<rootDir>/src/tests/setupTests.ts'], | ||
testEnvironment: 'jest-environment-jsdom', | ||
testMatch: [ | ||
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}', | ||
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}', | ||
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}', | ||
], | ||
transform: { | ||
'^.+\\.(t|j)sx?$': [ | ||
'@swc/jest', | ||
{ | ||
sourceMaps: true, | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
tsx: true, | ||
decorators: false, | ||
dynamicImport: true, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: [], | ||
}; | ||
|
||
const standard = require('@grafana/toolkit/src/config/jest.plugin.config'); | ||
|
||
const config = standard.jestConfig(); | ||
|
||
// allows us to have our own custom set up test file | ||
config.setupFilesAfterEnv = ['<rootDir>/src/tests/setupTests.ts']; | ||
|
||
// This process will use the same config that `yarn test` is using | ||
module.exports = 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
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,2 +1,17 @@ | ||
// enables assertions such as toBeInTheDocument to be used in our tests | ||
import '@testing-library/jest-dom'; | ||
|
||
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom | ||
Object.defineProperty(global, 'matchMedia', { | ||
writable: true, | ||
value: jest.fn().mockImplementation((query) => ({ | ||
matches: false, | ||
media: query, | ||
onchange: null, | ||
addListener: jest.fn(), // deprecated | ||
removeListener: jest.fn(), // deprecated | ||
addEventListener: jest.fn(), | ||
removeEventListener: jest.fn(), | ||
dispatchEvent: jest.fn(), | ||
})), | ||
}); |
Oops, something went wrong.