From dd1fe1d0b01723ef4d88f5eb24d34eae0cf7ac1c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:25:06 -0400 Subject: [PATCH] chore(deps): update node.js to v20.5.1 (#4607) * chore(deps): update node.js to v20.5.1 * add import path to suppress error * fix `loadConfig` tests * fix validate config sourcemaps tests * normalize path for Windows --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Tanner Reits --- package.json | 2 +- src/compiler/config/test/load-config.spec.ts | 17 +++++---- .../test/validate-config-sourcemap.spec.ts | 5 ++- src/testing/tsconfig.internal.json | 35 +++++-------------- 4 files changed, 20 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index d856cde40ec..3fe60896762 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,7 @@ ], "prettier": "@ionic/prettier-config", "volta": { - "node": "20.4.0", + "node": "20.5.1", "npm": "9.8.1" } } diff --git a/src/compiler/config/test/load-config.spec.ts b/src/compiler/config/test/load-config.spec.ts index fd3acae826f..754d6d4290d 100644 --- a/src/compiler/config/test/load-config.spec.ts +++ b/src/compiler/config/test/load-config.spec.ts @@ -10,10 +10,10 @@ import { normalizePath } from '../../../utils'; import { loadConfig } from '../load-config'; describe('load config', () => { - const configPath = 'fixtures/stencil.config.ts'; - const configPath2 = 'fixtures/stencil.config2.ts'; + const configPath = require.resolve('./fixtures/stencil.config.ts'); + const configPath2 = require.resolve('./fixtures/stencil.config2.ts'); + let sys: d.CompilerSystem; - const noTsConfigPath = 'no-ts-dir/stencil.config.ts'; beforeEach(() => { sys = createNodeSys(); @@ -41,7 +41,6 @@ describe('load config', () => { [configPath]: mock.load(path.resolve(__dirname, configPath)), [configPath2]: mock.load(path.resolve(__dirname, configPath2)), 'fixtures/tsconfig.json': tsconfig, - [noTsConfigPath]: mock.load(path.resolve(__dirname, configPath)), ...getMockFSPatch(mock), }); }); @@ -103,23 +102,23 @@ describe('load config', () => { }); it('creates a tsconfig file when "initTsConfig" set', async () => { - const tsconfigPath = path.resolve(path.dirname(noTsConfigPath), 'tsconfig.json'); + const tsconfigPath = path.resolve(path.dirname(configPath), 'tsconfig.json'); expect(fs.existsSync(tsconfigPath)).toBe(false); - const loadedConfig = await loadConfig({ initTsConfig: true, configPath: noTsConfigPath }); + const loadedConfig = await loadConfig({ initTsConfig: true, configPath }); expect(fs.existsSync(tsconfigPath)).toBe(true); expect(loadedConfig.diagnostics).toHaveLength(0); }); it('errors that a tsconfig file could not be created when "initTsConfig" isn\'t present', async () => { - const loadedConfig = await loadConfig({ configPath: noTsConfigPath }); + const loadedConfig = await loadConfig({ configPath }); expect(loadedConfig.diagnostics).toHaveLength(1); expect(loadedConfig.diagnostics[0]).toEqual({ absFilePath: undefined, header: 'Missing tsconfig.json', level: 'error', lines: [], - messageText: `Unable to load TypeScript config file. Please create a "tsconfig.json" file within the "./${path.dirname( - noTsConfigPath, + messageText: `Unable to load TypeScript config file. Please create a "tsconfig.json" file within the "${normalizePath( + path.dirname(configPath), )}" directory.`, relFilePath: undefined, type: 'build', diff --git a/src/compiler/config/test/validate-config-sourcemap.spec.ts b/src/compiler/config/test/validate-config-sourcemap.spec.ts index 2e6120ff81f..e09c61af9e9 100644 --- a/src/compiler/config/test/validate-config-sourcemap.spec.ts +++ b/src/compiler/config/test/validate-config-sourcemap.spec.ts @@ -8,8 +8,7 @@ import type * as d from '../../../declarations'; import { loadConfig } from '../load-config'; describe('stencil config - sourceMap option', () => { - const fixturesDir = 'fixtures'; - const configPath = path.join(fixturesDir, 'stencil.config.ts'); + const configPath = require.resolve('./fixtures/stencil.config.ts'); let sys: d.CompilerSystem; /** @@ -21,7 +20,7 @@ describe('stencil config - sourceMap option', () => { */ const getLoadConfigForTests = (overrides?: Partial): d.LoadConfigInit => { const defaults: d.LoadConfigInit = { - configPath: configPath, + configPath, sys, config: {}, initTsConfig: true, diff --git a/src/testing/tsconfig.internal.json b/src/testing/tsconfig.internal.json index 1926b09d9c2..83862c99736 100644 --- a/src/testing/tsconfig.internal.json +++ b/src/testing/tsconfig.internal.json @@ -8,11 +8,7 @@ "forceConsistentCasingInFileNames": true, "jsx": "react", "jsxFactory": "h", - "lib": [ - "dom", - "es2017", - "esnext.array" - ], + "lib": ["dom", "es2017", "esnext.array"], "module": "esnext", "moduleResolution": "node", "noImplicitAny": true, @@ -24,27 +20,14 @@ "useUnknownInCatchVariables": true, "baseUrl": ".", "paths": { - "@stencil/core/cli": [ - "../cli/index.ts" - ], - "@stencil/core/compiler": [ - "../compiler/index.ts" - ], - "@stencil/core/declarations": [ - "../declarations/index.ts" - ], - "@stencil/core/mock-doc": [ - "../mock-doc/index.ts" - ], - "@stencil/core/testing": [ - "../testing/index.ts" - ], - "@stencil/core": [ - "../index.ts" - ], - "@utils": [ - "../utils/index.ts" - ] + "@stencil/core/cli": ["../cli/index.ts"], + "@stencil/core/compiler": ["../compiler/index.ts"], + "@stencil/core/declarations": ["../declarations/index.ts"], + "@stencil/core/mock-doc": ["../mock-doc/index.ts"], + "@stencil/core/testing": ["../testing/index.ts"], + "@stencil/core": ["../index.ts"], + "@sys-api-node": ["../sys/node/index.ts"], + "@utils": ["../utils/index.ts"] } } }