From 5df5dd9022dd54cab7317567f43e53b6742cdd1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eligio=20Mari=C3=B1o?= <22875166+gmeligio@users.noreply.github.com> Date: Thu, 28 Dec 2023 23:55:53 +0100 Subject: [PATCH 1/3] chore: move test folder to root --- .projenrc.ts | 4 ++-- package.json | 4 ++-- pnpm-lock.yaml | 7 ++++--- {src/test => test}/CdktfConfig.test.ts | 4 ++-- {src/test => test}/CdktfTypescriptApp.test.ts | 4 ++-- {src/test => test}/TestProject.ts | 0 {src/test => test}/cdktf.fixture.json | 16 ++++++++-------- {src => test}/setupJest.js | 6 +++--- 8 files changed, 23 insertions(+), 22 deletions(-) rename {src/test => test}/CdktfConfig.test.ts (99%) rename {src/test => test}/CdktfTypescriptApp.test.ts (95%) rename {src/test => test}/TestProject.ts (100%) rename {src/test => test}/cdktf.fixture.json (96%) rename {src => test}/setupJest.js (94%) diff --git a/.projenrc.ts b/.projenrc.ts index 0a36314..f54d10c 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -160,9 +160,9 @@ const testOptions: TestOptions = { clearMocks: true, coverageProvider: 'v8', moduleFileExtensions: ['ts', 'js', 'json', 'node'], - setupFilesAfterEnv: ['/src/setupJest.js'], + setupFilesAfterEnv: ['/test/setupJest.js'], testEnvironment: 'node', - testMatch: ['src/**/test/*.ts'], + testMatch: ['test/**/*.test.ts'], testPathIgnorePatterns: ['/node_modules/', '.d.ts', '.js'], transform: { '\\.[jt]sx?$': new Transform('@swc/jest'), diff --git a/package.json b/package.json index ab1c26e..6830fa3 100644 --- a/package.json +++ b/package.json @@ -99,11 +99,11 @@ "node" ], "setupFilesAfterEnv": [ - "/src/setupJest.js" + "/test/setupJest.js" ], "testEnvironment": "node", "testMatch": [ - "src/**/test/*.ts", + "test/**/*.test.ts", "/src/**/__tests__/**/*.ts?(x)", "/(test|src)/**/*(*.)@(spec|test).ts?(x)" ], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f0f060..b3cd0fa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: '6.0' settings: - autoInstallPeers: false + autoInstallPeers: true excludeLinksFromLockfile: false dependencies: @@ -99,7 +99,7 @@ devDependencies: version: 9.5.0 ts-jest: specifier: ^29.1.1 - version: 29.1.1(jest@29.7.0)(typescript@5.3.3) + version: 29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.2(@swc/core@1.3.100)(@types/node@18.19.3)(typescript@5.3.3) @@ -6445,7 +6445,7 @@ packages: engines: {node: '>=8'} dev: true - /ts-jest@29.1.1(jest@29.7.0)(typescript@5.3.3): + /ts-jest@29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.3.3): resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -6466,6 +6466,7 @@ packages: esbuild: optional: true dependencies: + '@babel/core': 7.23.6 bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 jest: 29.7.0(@types/node@18.19.3)(ts-node@10.9.2) diff --git a/src/test/CdktfConfig.test.ts b/test/CdktfConfig.test.ts similarity index 99% rename from src/test/CdktfConfig.test.ts rename to test/CdktfConfig.test.ts index 90f2b8d..7457961 100644 --- a/src/test/CdktfConfig.test.ts +++ b/test/CdktfConfig.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import mockfs from 'mock-fs'; import { TestProject } from './TestProject'; -import { CdktfConfig, Language, RequirementDefinition } from '../CdktfConfig'; +import { CdktfConfig, Language, RequirementDefinition } from '../src/CdktfConfig'; describe('CdktfConfig', () => { describe('cdktfVersion', () => { @@ -67,7 +67,7 @@ describe('CdktfConfig', () => { // 'node_modules/.pnpm/projen@0.72.23/node_modules/projen/license-text/Apache-2.0.txt': mockfs.load( // path.resolve(__dirname, '../../node_modules/projen/license-text/Apache-2.0.txt') // ), - [licenseFilePath]: mockfs.load(path.resolve(__dirname, `../../node_modules/projen/${licenseRelativePath}`)), + [licenseFilePath]: mockfs.load(path.resolve(__dirname, `../node_modules/projen/${licenseRelativePath}`)), 'cdktf.json': mockfs.load(path.resolve(__dirname, 'cdktf.fixture.json')), }); diff --git a/src/test/CdktfTypescriptApp.test.ts b/test/CdktfTypescriptApp.test.ts similarity index 95% rename from src/test/CdktfTypescriptApp.test.ts rename to test/CdktfTypescriptApp.test.ts index f6886c1..b2a1d64 100644 --- a/src/test/CdktfTypescriptApp.test.ts +++ b/test/CdktfTypescriptApp.test.ts @@ -1,5 +1,5 @@ -import { Language } from '../CdktfConfig'; -import { CdktfTypeScriptApp } from '../CdktfTypescriptApp'; +import { Language } from '../src/CdktfConfig'; +import { CdktfTypeScriptApp } from '../src/CdktfTypescriptApp'; describe('CdktfApp', () => { describe('app', () => { diff --git a/src/test/TestProject.ts b/test/TestProject.ts similarity index 100% rename from src/test/TestProject.ts rename to test/TestProject.ts diff --git a/src/test/cdktf.fixture.json b/test/cdktf.fixture.json similarity index 96% rename from src/test/cdktf.fixture.json rename to test/cdktf.fixture.json index ab53c67..b2d1476 100644 --- a/src/test/cdktf.fixture.json +++ b/test/cdktf.fixture.json @@ -1,8 +1,8 @@ -{ - "app": "npx ts-node main.ts", - "language": "typescript", - "projectId": "12345678-1234-1234-1234-123456789012", - "sendCrashReports": "false", - "terraformProviders": [], - "terraformModules": [] -} +{ + "app": "npx ts-node main.ts", + "language": "typescript", + "projectId": "12345678-1234-1234-1234-123456789012", + "sendCrashReports": "false", + "terraformProviders": [], + "terraformModules": [] +} diff --git a/src/setupJest.js b/test/setupJest.js similarity index 94% rename from src/setupJest.js rename to test/setupJest.js index c8cff6d..7bd73c0 100644 --- a/src/setupJest.js +++ b/test/setupJest.js @@ -1,3 +1,3 @@ -import { Testing } from 'cdktf'; - -Testing.setupJest(); +import { Testing } from 'cdktf'; + +Testing.setupJest(); From 15f251f21cfd7eb0f34c88501a959c90002882a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eligio=20Mari=C3=B1o?= <22875166+gmeligio@users.noreply.github.com> Date: Thu, 28 Dec 2023 23:58:59 +0100 Subject: [PATCH 2/3] build: remove mock-fs from bundledDeps --- .projen/deps.json | 8 ++++---- .projenrc.ts | 5 ++--- package.json | 3 +-- pnpm-lock.yaml | 8 ++++---- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.projen/deps.json b/.projen/deps.json index 32d6920..8488848 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -90,6 +90,10 @@ "version": "~5.0.0", "type": "build" }, + { + "name": "mock-fs", + "type": "build" + }, { "name": "prettier", "type": "build" @@ -127,10 +131,6 @@ "name": "constructs", "type": "bundled" }, - { - "name": "mock-fs", - "type": "bundled" - }, { "name": "uuid", "type": "bundled" diff --git a/.projenrc.ts b/.projenrc.ts index f54d10c..8915283 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -76,10 +76,9 @@ const buildOptions: Pick< const projenDevDeps = ['projen@0.72.23', 'publib', '@types/uuid']; const projenDeps = ['uuid', 'cdktf', 'constructs', 'yaml']; -const jestDeps = ['mock-fs']; -const jestDevDeps = ['@swc/jest', '@swc/core', 'jest-junit', '@types/mock-fs']; +const jestDevDeps = ['@swc/jest', '@swc/core', 'jest-junit', '@types/mock-fs', 'mock-fs']; -const bundledDeps = ([] as string[]).concat(projenDeps, jestDeps); +const bundledDeps = ([] as string[]).concat(projenDeps); const devDeps = ([] as string[]).concat(projenDevDeps, jestDevDeps); const peerDeps = ([] as string[]).concat('projen'); diff --git a/package.json b/package.json index 6830fa3..47efcee 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "jsii-docgen": "^10.0.0", "jsii-pacmak": "^1.87.0", "jsii-rosetta": "~5.0.0", + "mock-fs": "^5.2.0", "prettier": "^3.0.2", "projen": "0.72.23", "publib": "^0.2.737", @@ -71,14 +72,12 @@ "dependencies": { "cdktf": "^0.19.0", "constructs": "^10.3.0", - "mock-fs": "^5.2.0", "uuid": "^9.0.0", "yaml": "^2.3.2" }, "bundledDependencies": [ "cdktf", "constructs", - "mock-fs", "uuid", "yaml" ], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3cd0fa..32a2fff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,9 +11,6 @@ dependencies: constructs: specifier: ^10.3.0 version: 10.3.0 - mock-fs: - specifier: ^5.2.0 - version: 5.2.0 uuid: specifier: ^9.0.0 version: 9.0.1 @@ -85,6 +82,9 @@ devDependencies: jsii-rosetta: specifier: ~5.0.0 version: 5.0.28 + mock-fs: + specifier: ^5.2.0 + version: 5.2.0 prettier: specifier: ^3.0.2 version: 3.1.1 @@ -5370,7 +5370,7 @@ packages: /mock-fs@5.2.0: resolution: {integrity: sha512-2dF2R6YMSZbpip1V1WHKGLNjr/k48uQClqMVb5H3MOvwc9qhYis3/IWbj02qIg/Y8MDXKFF4c5v0rxx2o6xTZw==} engines: {node: '>=12.0.0'} - dev: false + dev: true /modify-values@1.0.1: resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} From d0da59197889ba7be7df533ad1e73fef3789600b Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 28 Dec 2023 23:00:34 +0000 Subject: [PATCH 3/3] chore: self mutation Signed-off-by: github-actions --- pnpm-lock.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32a2fff..0c31f46 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: '6.0' settings: - autoInstallPeers: true + autoInstallPeers: false excludeLinksFromLockfile: false dependencies: @@ -99,7 +99,7 @@ devDependencies: version: 9.5.0 ts-jest: specifier: ^29.1.1 - version: 29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.3.3) + version: 29.1.1(jest@29.7.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.2(@swc/core@1.3.100)(@types/node@18.19.3)(typescript@5.3.3) @@ -6445,7 +6445,7 @@ packages: engines: {node: '>=8'} dev: true - /ts-jest@29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.3.3): + /ts-jest@29.1.1(jest@29.7.0)(typescript@5.3.3): resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -6466,7 +6466,6 @@ packages: esbuild: optional: true dependencies: - '@babel/core': 7.23.6 bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 jest: 29.7.0(@types/node@18.19.3)(ts-node@10.9.2)