Skip to content

Commit aa14233

Browse files
committed
🎨 Format code
1 parent d7d7c13 commit aa14233

File tree

6 files changed

+40
-36
lines changed

6 files changed

+40
-36
lines changed

src/__tests__/diff.test.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("getDiff", () => {
1919

2020
const result = await getDiff(
2121
testRemoteSchemaLocation,
22-
testRemoteSchemaLocation
22+
testRemoteSchemaLocation,
2323
);
2424
expect(result).toBeUndefined();
2525
});
@@ -38,7 +38,7 @@ describe("getDiff", () => {
3838
headers: {
3939
Test: "test",
4040
},
41-
}
41+
},
4242
);
4343
expect(result).toBeUndefined();
4444
});
@@ -68,7 +68,7 @@ describe("getDiff", () => {
6868
Test: "right",
6969
},
7070
},
71-
}
71+
},
7272
);
7373
expect(result).toBeUndefined();
7474
});
@@ -103,7 +103,7 @@ describe("getDiff", () => {
103103
Test: "right",
104104
},
105105
},
106-
}
106+
},
107107
);
108108
expect(result).toBeUndefined();
109109
});
@@ -115,7 +115,7 @@ describe("getDiff", () => {
115115
.reply(404, {});
116116

117117
return expect(
118-
getDiff(testRemoteSchemaLocation, testRemoteSchemaLocation)
118+
getDiff(testRemoteSchemaLocation, testRemoteSchemaLocation),
119119
).rejects.toThrow(/Could not obtain introspection result/);
120120
});
121121

@@ -126,7 +126,7 @@ describe("getDiff", () => {
126126
.reply(200, { invalid: "response" });
127127

128128
return expect(
129-
getDiff(testRemoteSchemaLocation, testRemoteSchemaLocation)
129+
getDiff(testRemoteSchemaLocation, testRemoteSchemaLocation),
130130
).rejects.toThrow(/Could not obtain introspection result/);
131131
});
132132

@@ -139,7 +139,7 @@ describe("getDiff", () => {
139139
it("works with exact path to file", async () => {
140140
const localSchemaLocation = path.join(
141141
__dirname,
142-
"./fixtures/localSchema.graphql"
142+
"./fixtures/localSchema.graphql",
143143
);
144144
const result = await getDiff(localSchemaLocation, localSchemaLocation);
145145
expect(result).toBeUndefined();
@@ -148,7 +148,7 @@ describe("getDiff", () => {
148148
it("works with glob pattern", async () => {
149149
const localSchemaLocation = path.join(
150150
__dirname,
151-
"./fixtures/**/localSchema.graphql"
151+
"./fixtures/**/localSchema.graphql",
152152
);
153153
const result = await getDiff(localSchemaLocation, localSchemaLocation);
154154
expect(result).toBeUndefined();
@@ -158,21 +158,21 @@ describe("getDiff", () => {
158158
return expect(
159159
getDiff(
160160
path.join(__dirname, "invalidLocation"),
161-
path.join(__dirname, "invalidLocation")
162-
)
161+
path.join(__dirname, "invalidLocation"),
162+
),
163163
).rejects.toThrow(
164-
/Unable to find any GraphQL type definitions for the following pointers/
164+
/Unable to find any GraphQL type definitions for the following pointers/,
165165
);
166166
});
167167

168168
it("throws error on non-existent files in glob pattern", () => {
169169
return expect(
170170
getDiff(
171171
path.join(__dirname, "/**/*.invalidgql"),
172-
path.join(__dirname, "/**/*.invalidgql")
173-
)
172+
path.join(__dirname, "/**/*.invalidgql"),
173+
),
174174
).rejects.toThrow(
175-
/Unable to find any GraphQL type definitions for the following pointer/
175+
/Unable to find any GraphQL type definitions for the following pointer/,
176176
);
177177
});
178178
});
@@ -181,7 +181,7 @@ describe("getDiff", () => {
181181
it("returns the exact diff between two schemas", async () => {
182182
const result = await getDiff(
183183
path.join(__dirname, "fixtures/localSchema.graphql"),
184-
path.join(__dirname, "fixtures/localSchemaDangerous.graphql")
184+
path.join(__dirname, "fixtures/localSchemaDangerous.graphql"),
185185
);
186186

187187
expect(result).toBeDefined();
@@ -194,7 +194,7 @@ describe("getDiff", () => {
194194
it("returns the diff between two schemas with changed directives", async () => {
195195
const result = await getDiff(
196196
path.join(__dirname, "fixtures/localSchemaDirective.graphql"),
197-
path.join(__dirname, "fixtures/localSchemaDirectiveChanged.graphql")
197+
path.join(__dirname, "fixtures/localSchemaDirectiveChanged.graphql"),
198198
);
199199

200200
expect(result).toBeDefined();
@@ -207,7 +207,7 @@ describe("getDiff", () => {
207207
it("returns dangerous changes", async () => {
208208
const result = await getDiff(
209209
path.join(__dirname, "fixtures/localSchema.graphql"),
210-
path.join(__dirname, "fixtures/localSchemaDangerous.graphql")
210+
path.join(__dirname, "fixtures/localSchemaDangerous.graphql"),
211211
);
212212

213213
expect(result).toBeDefined();
@@ -225,7 +225,7 @@ describe("getDiff", () => {
225225
it("returns breaking changes", async () => {
226226
const result = await getDiff(
227227
path.join(__dirname, "fixtures/localSchema.graphql"),
228-
path.join(__dirname, "fixtures/localSchemaBreaking.graphql")
228+
path.join(__dirname, "fixtures/localSchemaBreaking.graphql"),
229229
);
230230

231231
expect(result).toBeDefined();
@@ -245,7 +245,7 @@ describe("getDiff", () => {
245245
it("returns diff between two unsorted, but otherwise equal schemas, when sorting not enabled", async () => {
246246
const result = await getDiff(
247247
path.join(__dirname, "fixtures/localSchemaSorted.graphql"),
248-
path.join(__dirname, "fixtures/localSchemaUnsorted.graphql")
248+
path.join(__dirname, "fixtures/localSchemaUnsorted.graphql"),
249249
);
250250

251251
expect(result).toBeDefined();
@@ -255,7 +255,7 @@ describe("getDiff", () => {
255255
const result = await getDiff(
256256
path.join(__dirname, "fixtures/localSchemaSorted.graphql"),
257257
path.join(__dirname, "fixtures/localSchemaUnsorted.graphql"),
258-
{ sortSchema: true }
258+
{ sortSchema: true },
259259
);
260260

261261
expect(result).toBeUndefined();

src/__tests__/fixtures/localSchemaDirective.graphql

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
directive @test(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | INPUT_FIELD_DEFINITION | ENUM | INPUT_OBJECT
1+
directive @test(
2+
name: String!
3+
) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | INPUT_FIELD_DEFINITION | ENUM | INPUT_OBJECT
24

35
type Query {
46
test: String

src/__tests__/fixtures/localSchemaDirectiveChanged.graphql

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
directive @test(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | INPUT_FIELD_DEFINITION | ENUM | INPUT_OBJECT
1+
directive @test(
2+
name: String!
3+
) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | INPUT_FIELD_DEFINITION | ENUM | INPUT_OBJECT
24

35
type Query @test(name: "TEST") {
46
test: String

src/cli.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const cli = meow(
6868
alias: "v",
6969
},
7070
},
71-
}
71+
},
7272
);
7373

7474
function parseHeaders(headerInput?: string | string[]): Headers | undefined {
@@ -89,7 +89,7 @@ function parseHeaders(headerInput?: string | string[]): Headers | undefined {
8989
...result,
9090
...(key && value && { [key]: value }),
9191
}),
92-
{}
92+
{},
9393
);
9494
}
9595

@@ -109,8 +109,8 @@ if (!leftSchemaLocation || !rightSchemaLocation) {
109109
chalk.red("ERROR: Schema locations missing!\n\n"),
110110
chalk.gray(
111111
"Usage\n" +
112-
" $ graphql-schema-diff <leftSchemaLocation> <rightSchemaLocation>"
113-
)
112+
" $ graphql-schema-diff <leftSchemaLocation> <rightSchemaLocation>",
113+
),
114114
);
115115
process.exit(1);
116116
}

src/diff.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface DiffOptions {
3636
export async function getDiff(
3737
leftSchemaLocation: string,
3838
rightSchemaLocation: string,
39-
options: DiffOptions = {}
39+
options: DiffOptions = {},
4040
): Promise<DiffResponse | undefined> {
4141
const getSchemaOptions = (customHeaders?: Headers) => ({
4242
headers: { ...options.headers, ...customHeaders },

src/html.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface Options {
4141

4242
export async function createHtmlOutput(
4343
diff: string,
44-
options: Options = {}
44+
options: Options = {},
4545
): Promise<void> {
4646
const { outputDirectory = "schemaDiff" } = options;
4747

@@ -54,35 +54,35 @@ export async function createHtmlOutput(
5454

5555
const diff2HtmlPath = path.dirname(require.resolve("diff2html/package.json"));
5656
const highlightJsPath = path.dirname(
57-
require.resolve("@highlightjs/cdn-assets/package.json")
57+
require.resolve("@highlightjs/cdn-assets/package.json"),
5858
);
5959

6060
await Promise.all([
6161
fs.copy(
6262
path.join(diff2HtmlPath, "bundles/js/diff2html.min.js"),
63-
path.join(outputDirectory, "js/diff2html.min.js")
63+
path.join(outputDirectory, "js/diff2html.min.js"),
6464
),
6565
fs.copy(
6666
path.join(diff2HtmlPath, "bundles/css/diff2html.min.css"),
67-
path.join(outputDirectory, "css/diff2html.min.css")
67+
path.join(outputDirectory, "css/diff2html.min.css"),
6868
),
6969
fs.copy(
7070
path.join(highlightJsPath, "styles/default.min.css"),
71-
path.join(outputDirectory, "css/hljs.min.css")
71+
path.join(outputDirectory, "css/hljs.min.css"),
7272
),
7373
fs.copy(
7474
path.join(highlightJsPath, "highlight.min.js"),
75-
path.join(outputDirectory, "js/highlight.min.js")
75+
path.join(outputDirectory, "js/highlight.min.js"),
7676
),
7777
fs.copy(
7878
path.join(highlightJsPath, "languages/graphql.min.js"),
79-
path.join(outputDirectory, "js/graphql.min.js")
79+
path.join(outputDirectory, "js/graphql.min.js"),
8080
),
8181
]);
8282

8383
const diff2htmlUiBase = (
8484
await fs.readFile(
85-
path.join(diff2HtmlPath, "bundles/js/diff2html-ui-base.min.js")
85+
path.join(diff2HtmlPath, "bundles/js/diff2html-ui-base.min.js"),
8686
)
8787
)
8888
.toString()
@@ -94,7 +94,7 @@ export async function createHtmlOutput(
9494
fs.writeFile(path.join(outputDirectory, "index.html"), htmlOutput),
9595
fs.writeFile(
9696
path.join(outputDirectory, "js/diff2html-ui-base.min.js"),
97-
diff2htmlUiBase
97+
diff2htmlUiBase,
9898
),
9999
]);
100100
}

0 commit comments

Comments
 (0)