tests: add windows to os matrix (#405)
This commit is contained in:
parent
fe2553cf97
commit
bf0df64ebd
|
@ -7,8 +7,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x]
|
||||
# todo windows-latest
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -19,7 +18,6 @@ jobs:
|
|||
run: yarn --frozen-lockfile
|
||||
- name: Test
|
||||
run: yarn -s test
|
||||
|
||||
test-examples:
|
||||
strategy:
|
||||
matrix:
|
||||
|
|
|
@ -9,8 +9,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x]
|
||||
# todo windows-latest
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
"devDependencies": {
|
||||
"@types/graphql-iso-date": "^3.3.3",
|
||||
"@types/graphql-relay": "^0.4.11",
|
||||
"@types/jest": "^23.3.7",
|
||||
"@types/jest": "^25.2.3",
|
||||
"@types/node": "^10.12.2",
|
||||
"@types/prettier": "^1.18.3",
|
||||
"@typescript-eslint/eslint-plugin": "2.7.0",
|
||||
|
@ -86,12 +86,12 @@
|
|||
"graphql-iso-date": "^3.6.1",
|
||||
"graphql-relay": "^0.6.0",
|
||||
"husky": "^1.1.2",
|
||||
"jest": "^24.9.0",
|
||||
"jest-watch-typeahead": "^0.3.1",
|
||||
"jest": "^26.0.1",
|
||||
"jest-watch-typeahead": "^0.6.0",
|
||||
"lint-staged": "^7.3.0",
|
||||
"prettier": "^1.19.1",
|
||||
"sort-package-json": "^1.22.1",
|
||||
"ts-jest": "^24.1.0",
|
||||
"ts-jest": "^26.0.0",
|
||||
"ts-node": "^7.0.1",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.15.0",
|
||||
|
|
|
@ -35,32 +35,36 @@ describe("makeSchema", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("exits with 1 code and logs error after failure", (done) => {
|
||||
const errSpy = jest
|
||||
.spyOn(console, "error")
|
||||
.mockImplementationOnce(() => {});
|
||||
jest.spyOn(process, "exit").mockImplementationOnce((code) => {
|
||||
expect(code).toEqual(1);
|
||||
expect(errSpy.mock.calls[0][0].message).toEqual(
|
||||
`ENOTDIR: not a directory, open '/dev/null/schema.graphql'`
|
||||
);
|
||||
return done() as never;
|
||||
// using jest.spyOn on process.exit doesn't not work on Windows
|
||||
if (process.platform !== "win32") {
|
||||
it("exits with 1 code and logs error after failure", (done) => {
|
||||
const errSpy = jest
|
||||
.spyOn(console, "error")
|
||||
.mockImplementationOnce(() => {});
|
||||
jest.spyOn(process, "exit").mockImplementationOnce((code) => {
|
||||
expect(code).toEqual(1);
|
||||
expect(errSpy.mock.calls[0][0].message).toEqual(
|
||||
`ENOTDIR: not a directory, open '/dev/null/schema.graphql'`
|
||||
);
|
||||
expect(errSpy.mock.calls.length).toEqual(1);
|
||||
return done() as never;
|
||||
});
|
||||
makeSchema({
|
||||
types: [
|
||||
queryField("someField", {
|
||||
type: "String",
|
||||
resolve: () => "Test",
|
||||
}),
|
||||
],
|
||||
outputs: {
|
||||
typegen: path.normalize(`/dev/null/file.ts`),
|
||||
schema: path.normalize(`/dev/null/schema.graphql`),
|
||||
},
|
||||
shouldGenerateArtifacts: true,
|
||||
shouldExitAfterGenerateArtifacts: true,
|
||||
});
|
||||
});
|
||||
makeSchema({
|
||||
types: [
|
||||
queryField("someField", {
|
||||
type: "String",
|
||||
resolve: () => "Test",
|
||||
}),
|
||||
],
|
||||
outputs: {
|
||||
typegen: `/dev/null/file.ts`,
|
||||
schema: `/dev/null/schema.graphql`,
|
||||
},
|
||||
shouldGenerateArtifacts: true,
|
||||
shouldExitAfterGenerateArtifacts: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
it("accepts a customPrintSchemaFn", async () => {
|
||||
const { schemaTypes } = await generateSchema.withArtifacts(
|
||||
|
|
|
@ -40,6 +40,8 @@ describe("typegenPrinter", () => {
|
|||
contextType: "t.TestContext",
|
||||
},
|
||||
});
|
||||
// give time for artifact generation to complete
|
||||
await new Promise((res) => setTimeout(res, 2000));
|
||||
const typegenInfo = await metadata.getTypegenInfo(schema);
|
||||
typegen = new TypegenPrinter(metadata.sortSchema(schema), {
|
||||
...typegenInfo,
|
||||
|
|
Loading…
Reference in New Issue