|
1 | 1 | // @ts-check
|
2 | 2 |
|
3 |
| -import { test } from "node:test"; |
4 | 3 | import * as assert from "node:assert";
|
5 |
| -import { semanticToStrict, semanticToNullable } from "../dist/index.js"; |
6 |
| -import { buildSchema, printSchema } from "graphql"; |
7 | 4 | import { readdir, readFile } from "node:fs/promises";
|
| 5 | +import { test } from "node:test"; |
| 6 | + |
| 7 | +import * as graphql from "graphql"; |
| 8 | + |
| 9 | +import { semanticToNullable, semanticToStrict } from "../dist/index.js"; |
| 10 | + |
| 11 | +const { buildSchema, printSchema } = graphql; |
| 12 | + |
| 13 | +const isSemanticNonNullType = /** @type {any} */ (graphql) |
| 14 | + .isSemanticNonNullType; |
8 | 15 |
|
9 | 16 | const TEST_DIR = import.meta.dirname;
|
10 | 17 | const files = await readdir(TEST_DIR);
|
| 18 | +const skip = test.skip.bind(test); |
11 | 19 |
|
12 | 20 | for (const file of files) {
|
13 | 21 | if (file.endsWith(".test.graphql") && !file.startsWith(".")) {
|
14 |
| - test(file.replace(/\.test\.graphql$/, ""), async () => { |
| 22 | + const pureDirective = file === "schema-with-directive-only.test.graphql"; |
| 23 | + const maybeTest = |
| 24 | + pureDirective || isSemanticNonNullType != null ? test : skip; |
| 25 | + maybeTest(file.replace(/\.test\.graphql$/, ""), async () => { |
15 | 26 | const sdl = await readFile(TEST_DIR + "/" + file, "utf8");
|
16 | 27 | const schema = buildSchema(sdl);
|
17 | 28 | await test("semantic-to-strict", async () => {
|
|
0 commit comments