From 03aad637ba2f357eb87b2f4dedb788c7634ba423 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 30 Oct 2021 17:37:11 -0400 Subject: [PATCH] chore(ci): fix ci --- .github/workflows/ci.yml | 8 ++++---- deno/ts_morph.js | 5 +++++ packages/ts-morph/package.json | 2 +- packages/ts-morph/src/tests/issues/1198tests.ts | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9de410e5..92b64a362 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,18 +4,18 @@ on: [push, pull_request] jobs: build: - name: test ubuntu-16.04 - runs-on: ubuntu-16.04 + name: test ubuntu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: '12' + node-version: '16' check-latest: true - uses: bvm/gh-action@v1.1.0 - name: Build run: | - npm install + npm ci npm run bootstrap npm run build npx lerna run ensure-no-project-compile-errors diff --git a/deno/ts_morph.js b/deno/ts_morph.js index 84ed48529..b3e02cac3 100644 --- a/deno/ts_morph.js +++ b/deno/ts_morph.js @@ -1411,6 +1411,11 @@ class StraightReplacementNodeHandler { } handleNode(currentNode, newNode, newSourceFile) { if (currentNode.getKind() !== newNode.kind) { + const kinds = [currentNode.getKind(), newNode.kind]; + if (kinds.includes(ts.SyntaxKind.Identifier) && kinds.includes(ts.SyntaxKind.PrivateIdentifier)) { + currentNode.forget(); + return; + } throw new errors.InvalidOperationError(`Error replacing tree! Perhaps a syntax error was inserted ` + `(Current: ${currentNode.getKindName()} -- New: ${getSyntaxKindName(newNode.kind)}).`); } diff --git a/packages/ts-morph/package.json b/packages/ts-morph/package.json index cb1e1b2b6..99deb21a2 100644 --- a/packages/ts-morph/package.json +++ b/packages/ts-morph/package.json @@ -13,7 +13,7 @@ "test": "cross-env TS_NODE_COMPILER=\"ttypescript\" TS_NODE_TRANSPILE_ONLY=\"true\" mocha", "test:debug": "npm run test --inspect-brk", "test:watch": "npm run test --watch-extensions ts --watch", - "test:ci": "npm run run test", + "test:ci": "npm run test", "test:ts-versions": "ts-node --transpile-only scripts/test/testTypeScriptVersions", "test:coverage": "cross-env TS_NODE_COMPILER=\"ttypescript\" TS_NODE_TRANSPILE_ONLY=\"true\" nyc --reporter=lcov mocha", "test:performance": "npm run build && node ./dist/tests/performance/run.js", diff --git a/packages/ts-morph/src/tests/issues/1198tests.ts b/packages/ts-morph/src/tests/issues/1198tests.ts index f1b7e54bb..72ee14799 100644 --- a/packages/ts-morph/src/tests/issues/1198tests.ts +++ b/packages/ts-morph/src/tests/issues/1198tests.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import { Project } from "../../Project"; -describe.only("tests for issue #1198", () => { +describe("tests for issue #1198", () => { it("should not have issues when renaming private identifier", () => { const project = new Project({ useInMemoryFileSystem: true }); const sourceFile = project.createSourceFile("mod.ts", `class Foo {