Skip to content

Commit

Permalink
migrate graphql-language-service-cli to vitest (#3833)
Browse files Browse the repository at this point in the history
* a

* a
  • Loading branch information
dimaMachina authored Dec 14, 2024
1 parent dedb871 commit 2a9a77c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/graphql-language-service-cli/jest.config.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/graphql-language-service-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"dist",
"src"
],
"scripts": {
"test": "vitest"
},
"keywords": [
"graphql",
"graphql-language-service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import main from '../client';

describe('process.stderr.write', () => {
afterEach(() => {
jest.restoreAllMocks();
vi.restoreAllMocks();
});

it('is passed information on error of string type', () => {
const argv = {
schemaPath: '...',
text: 'foo',
};
const mockStdErrWrite = jest
const mockStdErrWrite = vi
.spyOn(process.stderr, 'write')
.mockImplementation();
jest.spyOn(process, 'exit').mockImplementation();
vi.spyOn(process, 'exit').mockImplementation(() => {});
const undefinedWithNewLine = /^undefined\n$/;

main('autocomplete', argv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

describe('blinking light demo', () => {
it('runs', () => {
// This is just a place holder for now as all the existing tests have moved
// This is just a placeholder for now as all the existing tests have moved
// down into the respective package directories. In the future, this will be
// the home of the integration tests.
expect(true).toEqual(true);
Expand Down
3 changes: 2 additions & 1 deletion packages/graphql-language-service-cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"composite": true,
"rootDir": "./src",
"outDir": "./dist",
"target": "ES2018"
"target": "ES2018",
"types": ["vitest/globals"]
},
"references": [
{
Expand Down
7 changes: 7 additions & 0 deletions packages/graphql-language-service-cli/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
},
});

0 comments on commit 2a9a77c

Please sign in to comment.