From 78163a96dcf736fe854673a5cd6d2e869078a565 Mon Sep 17 00:00:00 2001 From: Peter Pistorius Date: Mon, 20 Jul 2020 10:25:08 +0200 Subject: [PATCH] Fix tests. --- babel.config.js | 2 +- .../commands/destroy/cell/__tests__/cell.test.js | 8 ++++++++ .../commands/generate/cell/__tests__/cell.test.js | 8 ++++++++ .../generate/scaffold/__tests__/scaffold.test.js | 2 +- packages/cli/tsconfig.json | 14 ++++++++++++++ tsconfig.json | 2 +- 6 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 packages/cli/tsconfig.json diff --git a/babel.config.js b/babel.config.js index 6b69b4972d15..02424ef47ddd 100644 --- a/babel.config.js +++ b/babel.config.js @@ -37,7 +37,7 @@ module.exports = { ], /** * NOTE - * Experimental decorators are used in `@redwoodjs/project-model`. + * Experimental decorators are used in `@redwoodjs/structure`. * https://github.com/tc39/proposal-decorators **/ ['@babel/plugin-proposal-decorators', { legacy: true }], diff --git a/packages/cli/src/commands/destroy/cell/__tests__/cell.test.js b/packages/cli/src/commands/destroy/cell/__tests__/cell.test.js index a5d45fd96f5f..d1a67ba7c2f6 100644 --- a/packages/cli/src/commands/destroy/cell/__tests__/cell.test.js +++ b/packages/cli/src/commands/destroy/cell/__tests__/cell.test.js @@ -7,6 +7,14 @@ jest.mock('src/lib', () => { } }) +jest.mock('@redwoodjs/structure', () => { + return { + getProject: () => ({ + cells: [{ queryOperationName: undefined }], + }), + } +}) + import fs from 'fs' import 'src/lib/test' diff --git a/packages/cli/src/commands/generate/cell/__tests__/cell.test.js b/packages/cli/src/commands/generate/cell/__tests__/cell.test.js index f699d2bd1d08..95cb40986836 100644 --- a/packages/cli/src/commands/generate/cell/__tests__/cell.test.js +++ b/packages/cli/src/commands/generate/cell/__tests__/cell.test.js @@ -3,6 +3,14 @@ import path from 'path' import { loadGeneratorFixture } from 'src/lib/test' +jest.mock('@redwoodjs/structure', () => { + return { + getProject: () => ({ + cells: [{ queryOperationName: undefined }], + }), + } +}) + import * as cell from '../cell' let singleWordFiles, multiWordFiles diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js index 2741d58c4ed0..5eb6cd55955d 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js @@ -7,7 +7,7 @@ import { getDefaultArgs } from 'src/lib' import { yargsDefaults as defaults } from '../../../generate' import * as scaffold from '../scaffold' -describe('in javascript (defualt) mode', () => { +describe('in javascript (default) mode', () => { let files beforeAll(async () => { diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json new file mode 100644 index 000000000000..4050cd70786f --- /dev/null +++ b/packages/cli/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.compilerOption.json", + "compilerOptions": { + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo", + "baseUrl": ".", + "rootDir": "src", + "outDir": "dist" + }, + "include": ["src"], + "references": [ + { "path": "../internal" }, + { "path": "../structure" }, + ] +} diff --git a/tsconfig.json b/tsconfig.json index 7ad6bccf92d3..909ba248d89e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ { "path": "packages/internal" }, { "path": "packages/auth" }, { "path": "packages/testing" }, - { "path": "packages/project-model" } + { "path": "packages/structure" } ], "files": [] }