Skip to content

Commit 9954426

Browse files
authored
Upgrade TypeScript to 4.6 (#1222)
* Upgrade TypeScript to 4.6 * Upgrade pipeline node.js * Fix prettyformat error
1 parent a434ab2 commit 9954426

File tree

8 files changed

+602
-1430
lines changed

8 files changed

+602
-1430
lines changed

.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ module.exports = {
7474
"jest/expect-expect": "off",
7575
"jest/consistent-test-it": ["error", { fn: "test", withinDescribe: "test" }],
7676
"jest/no-disabled-tests": "error",
77-
"jest/no-expect-resolves": "error",
7877
"jest/no-identical-title": "off",
7978
"jest/no-test-return-statement": "error",
80-
"jest/no-truthy-falsy": "error",
8179
"jest/prefer-spy-on": "error",
8280
"jest/prefer-todo": "error",
8381
"jest/valid-title": "error",

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 16.14.0
1618
- run: npm ci
1719
- run: npm run lint
1820
env:
@@ -30,7 +32,7 @@ jobs:
3032
- name: Use Node.js 15.14.0
3133
uses: actions/setup-node@v1
3234
with:
33-
node-version: 15.14.0
35+
node-version: 16.14.0
3436
- run: npm ci
3537
- run: npm run build
3638
- run: npx jest --maxWorkers 2 --coverage
@@ -60,7 +62,7 @@ jobs:
6062
- name: Use Node.js 12.13.1
6163
uses: actions/setup-node@v1
6264
with:
63-
node-version: 12.13.1
65+
node-version: 16.14.0
6466
# NPM
6567
- name: NPM master
6668
run: npm ci && npm run build

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Use Node.js 12.13.1
1515
uses: actions/setup-node@v1
1616
with:
17-
node-version: 12.13.1
17+
node-version: 16.14.0
1818
registry-url: "https://registry.npmjs.org"
1919
- run: npm ci
2020
- run: npm run build

package-lock.json

Lines changed: 584 additions & 1412 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"node": ">=12.13.0"
4343
},
4444
"peerDependencies": {
45-
"typescript": "~4.5.2"
45+
"typescript": "~4.6.2"
4646
},
4747
"dependencies": {
4848
"enhanced-resolve": "^5.8.2",
@@ -52,23 +52,23 @@
5252
"devDependencies": {
5353
"@types/fs-extra": "^8.1.0",
5454
"@types/glob": "^7.1.1",
55-
"@types/jest": "^25.1.3",
55+
"@types/jest": "^27.4.1",
5656
"@types/node": "^13.7.7",
5757
"@types/resolve": "1.14.0",
58-
"@typescript-eslint/eslint-plugin": "^5.4.0",
59-
"@typescript-eslint/parser": "^5.4.0",
60-
"eslint": "^7.32.0",
61-
"eslint-plugin-import": "^2.24.2",
62-
"eslint-plugin-jest": "^24.4.0",
58+
"@typescript-eslint/eslint-plugin": "^5.13.0",
59+
"@typescript-eslint/parser": "^5.13.0",
60+
"eslint": "^8.10.0",
61+
"eslint-plugin-import": "^2.25.4",
62+
"eslint-plugin-jest": "^26.1.1",
6363
"fs-extra": "^8.1.0",
6464
"javascript-stringify": "^2.0.1",
6565
"jest": "^27.3.0",
6666
"jest-circus": "^27.3.0",
6767
"lua-types": "2.10.1",
6868
"lua-wasm-bindings": "^0.2.2",
6969
"prettier": "^2.3.2",
70-
"ts-jest": "^27.0.7",
70+
"ts-jest": "^27.1.3",
7171
"ts-node": "^10.3.0",
72-
"typescript": "~4.5.2"
72+
"typescript": "~4.6.2"
7373
}
7474
}

test/transpile/bundle.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe("bundle with source maps", () => {
5252
// See https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1109
5353
test('the result file should not contain "{#SourceMapTraceback}" macro-string', () => {
5454
const { lua } = transpileResult.transpiledFiles[0];
55-
expect(lua).not.toBeUndefined();
55+
expect(lua).toBeDefined();
5656
expect(lua!).not.toContain("{#SourceMapTraceback}");
5757
});
5858

@@ -126,7 +126,7 @@ describe("bundle with source maps", () => {
126126

127127
const typescriptPosition = lineAndColumnOf(code[currentFile], typeScriptPattern);
128128
expect(mappedLine.line).toEqual(typescriptPosition.line);
129-
expect(mappedLine.file).toEqual(`${currentFile}.ts`);
129+
expect(mappedLine.file).toBe(`${currentFile}.ts`);
130130
}
131131
});
132132
});

test/transpile/module-resolution.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe("basic module resolution", () => {
4949

5050
test("can resolve package depencency with a dependency on another package", () => {
5151
// Declarations in the node_modules directory
52-
expect(projectWithNodeModules.getLuaExecutionResult().moduleWithDependencyResult).toEqual(
52+
expect(projectWithNodeModules.getLuaExecutionResult().moduleWithDependencyResult).toBe(
5353
"Calling dependency: foo from lua module with decls"
5454
);
5555
});

test/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export abstract class TestBuilder {
310310
const luaCode = transpiledFiles
311311
.filter(f => includeLualib || f.outPath !== "lualib_bundle.lua")
312312
.map(f => `[${f.outPath}]:\n${f.lua?.replace(/^/gm, " ")}`);
313-
const value = prettyFormat(this.getLuaExecutionResult()).replace(/^/gm, " ");
313+
const value = prettyFormat.format(this.getLuaExecutionResult()).replace(/^/gm, " ");
314314
console.log(`Lua Code:\n${luaCode.join("\n")}\n\nValue:\n${value}`);
315315
return this;
316316
}

0 commit comments

Comments
 (0)