Skip to content

Commit 2a9a77c

Browse files
authored
migrate graphql-language-service-cli to vitest (#3833)
* a * a
1 parent dedb871 commit 2a9a77c

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

packages/graphql-language-service-cli/jest.config.js

-1
This file was deleted.

packages/graphql-language-service-cli/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"dist",
2525
"src"
2626
],
27+
"scripts": {
28+
"test": "vitest"
29+
},
2730
"keywords": [
2831
"graphql",
2932
"graphql-language-service",

packages/graphql-language-service-cli/src/__tests__/client-test.ts renamed to packages/graphql-language-service-cli/src/__tests__/client.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ import main from '../client';
1010

1111
describe('process.stderr.write', () => {
1212
afterEach(() => {
13-
jest.restoreAllMocks();
13+
vi.restoreAllMocks();
1414
});
1515

1616
it('is passed information on error of string type', () => {
1717
const argv = {
1818
schemaPath: '...',
1919
text: 'foo',
2020
};
21-
const mockStdErrWrite = jest
21+
const mockStdErrWrite = vi
2222
.spyOn(process.stderr, 'write')
2323
.mockImplementation();
24-
jest.spyOn(process, 'exit').mockImplementation();
24+
vi.spyOn(process, 'exit').mockImplementation(() => {});
2525
const undefinedWithNewLine = /^undefined\n$/;
2626

2727
main('autocomplete', argv);

packages/graphql-language-service-cli/src/__tests__/index-test.ts renamed to packages/graphql-language-service-cli/src/__tests__/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
describe('blinking light demo', () => {
1010
it('runs', () => {
11-
// This is just a place holder for now as all the existing tests have moved
11+
// This is just a placeholder for now as all the existing tests have moved
1212
// down into the respective package directories. In the future, this will be
1313
// the home of the integration tests.
1414
expect(true).toEqual(true);

packages/graphql-language-service-cli/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"composite": true,
55
"rootDir": "./src",
66
"outDir": "./dist",
7-
"target": "ES2018"
7+
"target": "ES2018",
8+
"types": ["vitest/globals"]
89
},
910
"references": [
1011
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
globals: true,
6+
},
7+
});

0 commit comments

Comments
 (0)