···4747 run: pnpm run lint
48484949 - name: Unit Tests
5050- run: pnpm run test --maxWorkers=2
5050+ run: pnpm run test --run
51515252 - name: Build
5353 run: pnpm run build
+1
alias/language/__tests__/parser.test.js
···11// See: https://github.com/graphql/graphql-js/blob/976d64b/src/language/__tests__/parser-test.ts
22// Note: Tests regarding reserved keywords have been removed.
3344+import { describe, it, expect } from 'vitest';
45import { Kind } from 'graphql';
56import { parse, parseValue, parseType } from '../parser';
67
+4-9
alias/language/__tests__/printer.test.js
···11// See: https://github.com/graphql/graphql-js/blob/976d64b/src/language/__tests__/printer-test.ts
2233+import { describe, it, expect } from 'vitest';
34import { parse } from '../parser';
45import { print } from '../printer';
56···3536 }
3637 `);
37383838- const queryASTWithArtifacts = parse(
3939- 'query ($foo: TestType) @testDirective { id, name }'
4040- );
3939+ const queryASTWithArtifacts = parse('query ($foo: TestType) @testDirective { id, name }');
4140 expect(print(queryASTWithArtifacts)).toBe(dedent`
4241 query ($foo: TestType) @testDirective {
4342 id
···4544 }
4645 `);
47464848- const mutationASTWithArtifacts = parse(
4949- 'mutation ($foo: TestType) @testDirective { id, name }'
5050- );
4747+ const mutationASTWithArtifacts = parse('mutation ($foo: TestType) @testDirective { id, name }');
5148 expect(print(mutationASTWithArtifacts)).toBe(dedent`
5249 mutation ($foo: TestType) @testDirective {
5350 id
···6865 });
69667067 it('keeps arguments on one line if line is short (<= 80 chars)', () => {
7171- const printed = print(
7272- parse('{trip(wheelchair:false arriveBy:false){dateTime}}')
7373- );
6868+ const printed = print(parse('{trip(wheelchair:false arriveBy:false){dateTime}}'));
74697570 expect(printed).toBe(
7671 dedent`
+13-41
alias/language/__tests__/visitor.test.js
···11// See: https://github.com/graphql/graphql-js/blob/976d64b/src/language/__tests__/visitor-test.ts
2233+import { describe, it, expect } from 'vitest';
34import { Kind, parse, print } from 'graphql';
45import { visit, visitInParallel, BREAK } from '../visitor';
56···268269269270 expect(ast).toEqual(parse('{ a, b, c { a, b, c } }', { noLocation: true }));
270271271271- expect(editedAST).toEqual(
272272- parse('{ a, c { a, c } }', { noLocation: true })
273273- );
272272+ expect(editedAST).toEqual(parse('{ a, c { a, c } }', { noLocation: true }));
274273 });
275274276275 it('allows for editing on leave', () => {
···286285287286 expect(ast).toEqual(parse('{ a, b, c { a, b, c } }', { noLocation: true }));
288287289289- expect(editedAST).toEqual(
290290- parse('{ a, c { a, c } }', { noLocation: true })
291291- );
288288+ expect(editedAST).toEqual(parse('{ a, c { a, c } }', { noLocation: true }));
292289 });
293290294291 it('ignores false returned on leave', () => {
···299296 },
300297 });
301298302302- expect(returnedAST).toEqual(
303303- parse('{ a, b, c { a, b, c } }', { noLocation: true })
304304- );
299299+ expect(returnedAST).toEqual(parse('{ a, b, c { a, b, c } }', { noLocation: true }));
305300 });
306301307302 it('visits edited node', () => {
···478473 });
479474480475 it('handles deep immutable edits correctly when using "enter"', () => {
481481- const formatNode = (node) => {
476476+ const formatNode = node => {
482477 if (
483478 node.selectionSet &&
484479 !node.selectionSet.selections.some(
485485- (node) =>
486486- node.kind === Kind.FIELD &&
487487- node.name.value === '__typename' &&
488488- !node.alias
480480+ node => node.kind === Kind.FIELD && node.name.value === '__typename' && !node.alias
489481 )
490482 ) {
491483 return {
···507499 }
508500 };
509501 const ast = parse('{ players { nodes { id } } }');
510510- const expected = parse(
511511- '{ players { nodes { id __typename } __typename } }'
512512- );
502502+ const expected = parse('{ players { nodes { id __typename } __typename } }');
513503 const visited = visit(ast, {
514504 Field: formatNode,
515505 InlineFragment: formatNode,
···525515526516 visit(ast, {
527517 enter(node, key, parent) {
528528- visited.push([
529529- 'enter',
530530- node.kind,
531531- key,
532532- isNode(parent) ? parent.kind : undefined,
533533- ]);
518518+ visited.push(['enter', node.kind, key, isNode(parent) ? parent.kind : undefined]);
534519535520 checkVisitorFnArgs(ast, arguments);
536521 argsStack.push([...arguments]);
537522 },
538523539524 leave(node, key, parent) {
540540- visited.push([
541541- 'leave',
542542- node.kind,
543543- key,
544544- isNode(parent) ? parent.kind : undefined,
545545- ]);
525525+ visited.push(['leave', node.kind, key, isNode(parent) ? parent.kind : undefined]);
546526547527 expect(argsStack.pop()).toEqual([...arguments]);
548528 },
···12691249 ])
12701250 );
1271125112721272- expect(ast).toEqual(
12731273- parse('{ a, b, c { a, b, c } }', { noLocation: true })
12741274- );
12521252+ expect(ast).toEqual(parse('{ a, b, c { a, b, c } }', { noLocation: true }));
1275125312761276- expect(editedAST).toEqual(
12771277- parse('{ a, c { a, c } }', { noLocation: true })
12781278- );
12541254+ expect(editedAST).toEqual(parse('{ a, c { a, c } }', { noLocation: true }));
1279125512801256 expect(visited).toEqual([
12811257 ['enter', 'Document', undefined],
···13331309 ])
13341310 );
1335131113361336- expect(ast).toEqual(
13371337- parse('{ a, b, c { a, b, c } }', { noLocation: true })
13381338- );
13121312+ expect(ast).toEqual(parse('{ a, b, c { a, b, c } }', { noLocation: true }));
1339131313401340- expect(editedAST).toEqual(
13411341- parse('{ a, c { a, c } }', { noLocation: true })
13421342- );
13141314+ expect(editedAST).toEqual(parse('{ a, c { a, c } }', { noLocation: true }));
1343131513441316 expect(visited).toEqual([
13451317 ['enter', 'Document', undefined],