From 7bb087a64197699fb60e8cbf0bb7d549d8794b69 Mon Sep 17 00:00:00 2001 From: ivojawer Date: Wed, 19 Jun 2024 19:56:43 -0300 Subject: [PATCH] upgrade wollok-ts to 4.1.2 --- .../parse-errors/fileWithParseErrors.wlk | 8 +------- package-lock.json | 14 +++++++------- package.json | 2 +- test/fullRepl.test.ts | 5 +++++ test/repl.test.ts | 1 + test/utils.test.ts | 5 +++++ 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/bad-files-examples/parse-errors/fileWithParseErrors.wlk b/examples/bad-files-examples/parse-errors/fileWithParseErrors.wlk index 230af0b..f4be5e9 100644 --- a/examples/bad-files-examples/parse-errors/fileWithParseErrors.wlk +++ b/examples/bad-files-examples/parse-errors/fileWithParseErrors.wlk @@ -1,7 +1 @@ -object pepita { - var energia = 0 - var extra = 0 - - // method without parentheses does not parse ok - method energiaTotal = energia + extra -} \ No newline at end of file +// the actual file doesnt matter since it isnt actually built (stubbed) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 83069a3..d7ca11b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "pkg": "^5.8.1", "socket.io": "^4.5.1", "winston": "^3.11.0", - "wollok-ts": "4.1.1" + "wollok-ts": "4.1.2" }, "bin": { "wollok": "build/src/index.js" @@ -6203,9 +6203,9 @@ } }, "node_modules/wollok-ts": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/wollok-ts/-/wollok-ts-4.1.1.tgz", - "integrity": "sha512-pALSw4ojwhn2yjOcf6pPr1ujGjUOigD6saSLLl0EWAjcIO3rwhaxqSkpGs/P3CtJk8F8zu8LRtpgNX2K+7mTBQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/wollok-ts/-/wollok-ts-4.1.2.tgz", + "integrity": "sha512-HkspUYloOfOQrbLG7jVTAJvlGB9JK3nA08eIEJwBa1bHGEnGCQDAmmkjxob3VnEd3TDLWz5JRo5ZsL+mP0hEAA==", "dependencies": { "@types/parsimmon": "^1.10.8", "parsimmon": "^1.18.1", @@ -10785,9 +10785,9 @@ } }, "wollok-ts": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/wollok-ts/-/wollok-ts-4.1.1.tgz", - "integrity": "sha512-pALSw4ojwhn2yjOcf6pPr1ujGjUOigD6saSLLl0EWAjcIO3rwhaxqSkpGs/P3CtJk8F8zu8LRtpgNX2K+7mTBQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/wollok-ts/-/wollok-ts-4.1.2.tgz", + "integrity": "sha512-HkspUYloOfOQrbLG7jVTAJvlGB9JK3nA08eIEJwBa1bHGEnGCQDAmmkjxob3VnEd3TDLWz5JRo5ZsL+mP0hEAA==", "requires": { "@types/parsimmon": "^1.10.8", "parsimmon": "^1.18.1", diff --git a/package.json b/package.json index 106d2e4..1011bc7 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "pkg": "^5.8.1", "socket.io": "^4.5.1", "winston": "^3.11.0", - "wollok-ts": "4.1.1" + "wollok-ts": "4.1.2" }, "devDependencies": { "@types/chai": "^4.3.9", diff --git a/test/fullRepl.test.ts b/test/fullRepl.test.ts index 3b02db2..93eb427 100644 --- a/test/fullRepl.test.ts +++ b/test/fullRepl.test.ts @@ -7,6 +7,7 @@ import { Interface } from 'readline' import sinon from 'sinon' import { ENTER } from '../src/utils' import { spyCalledWithSubstring } from './assertions' +import * as wollok from 'wollok-ts' chai.should() chai.use(chaiHttp) @@ -16,6 +17,7 @@ const expect = chai.expect const baseOptions = { darkMode: true, port: '8080', + host: 'localhost', skipDiagram: true, } @@ -39,6 +41,7 @@ describe('REPL integration test for valid project', () => { project: projectPath, skipValidations: false, darkMode: true, + host: 'localhost', port: '8080', skipDiagram: false, } @@ -86,6 +89,8 @@ describe('REPL integration test for invalid project', () => { }) it('should return exit code 12 if project has parse errors', async () => { + sinon.stub(wollok, 'buildEnvironment').throws(new Error('Failed to parse fileWithParseErrors.wlk')) + await expect(callRepl('fileWithParseErrors.wlk', buildOptionsFor('parse-errors'))).to.eventually.be.rejectedWith(/exit with 12 error code/) }) diff --git a/test/repl.test.ts b/test/repl.test.ts index d943e0c..f28b045 100644 --- a/test/repl.test.ts +++ b/test/repl.test.ts @@ -15,6 +15,7 @@ describe('REPL', () => { skipValidations: false, darkMode: true, port: '8080', + host: 'localhost', skipDiagram: false, } let interpreter: Interpreter diff --git a/test/utils.test.ts b/test/utils.test.ts index 7f1de2f..8ce7eac 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -7,14 +7,19 @@ import chaiAsPromised from 'chai-as-promised' import chai from 'chai' import { spyCalledWithSubstring } from './assertions' import { Problem, WOLLOK_EXTRA_STACK_TRACE_HEADER, validate, List } from 'wollok-ts' +import * as wollok from 'wollok-ts' describe('build & validating environment', () => { + afterEach(() => { + sinon.restore() + }) const badProjectPath = join('examples', 'bad-files-examples') it('should throw an exception if parsing fails', async () => { chai.use(chaiAsPromised) const expect = chai.expect + sinon.stub(wollok, 'buildEnvironment').throws(new Error('Failed to parse fileWithParseErrors.wlk')) await expect(buildEnvironmentForProject(join(badProjectPath, 'parse-errors'), ['fileWithParseErrors.wlk'])).to.eventually.be.rejectedWith(/Failed to parse fileWithParseErrors.wlk/) })