Skip to content

Instantly share code, notes, and snippets.

@Souvikns
Created January 11, 2023 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Souvikns/45c14ecef8f1260ec64b5aacc128c1d0 to your computer and use it in GitHub Desktop.
Save Souvikns/45c14ecef8f1260ec64b5aacc128c1d0 to your computer and use it in GitHub Desktop.
Error Log from running tests in asyncapi cli
➜ npm run test
> @asyncapi/cli@0.27.2 pretest
> npm run build
> @asyncapi/cli@0.27.2 build
> rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && echo "Build Completed"
Fetched ZIP file
Unzipped all examples from zip
Build Completed
> @asyncapi/cli@0.27.2 test
> cross-env NODE_ENV=development TEST=1 CONTEXT_FILENAME="./test.asyncapi" CONTEXT_FILE_PATH="./" jest --coverage -i
Generation in progress. Keep calm and wait a bit... done
Generation in progress. Keep calm and wait a bit... done
Generation in progress. Keep calm and wait a bit... done
Generation in progress. Keep calm and wait a bit... done
Generation in progress. Keep calm and wait a bit... done
Generation in progress. Keep calm and wait a bit... done
Generator Error: Cannot read properties of undefined (reading 'version')
Generation in progress. Keep calm and wait a bit... done
FAIL test/commands/generate/fromTemplate.test.ts (34.97 s)
● Console
console.log
Check out your shiny new generated files at ./test/doc.
at Template.<anonymous> (lib/commands/generate/fromTemplate.js:162:21)
● template › should throw error if output folder is in a git repository
expect(received).toContain(expected) // indexOf
Expected substring: "Error: \"./test/doc\" is in a git repository with unstaged changes."
Received string: "Generation in progress. Keep calm and wait a bit... ⡿
Generation in progress. Keep calm and wait a bit... ⣟
Generation in progress. Keep calm and wait a bit... ⣯
Generation in progress. Keep calm and wait a bit... ⣷
Generation in progress. Keep calm and wait a bit... done
"
73 | });
74 |
> 75 | describe('debug', () => {
| ^
76 | test
77 | .stdout()
78 | .command([
at Object.<anonymous> (test/commands/generate/fromTemplate.test.ts:75:28)
at Object.run (node_modules/fancy-test/lib/base.js:44:38)
at Object.run (node_modules/fancy-test/lib/base.js:68:36)
FAIL test/commands/validate.test.ts (16.346 s)
● validate › with file paths › works when url is passed
thrown: "Exceeded timeout of 10000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
40 | done();
41 | });
> 42 |
| ^
43 | test
44 | .stderr()
45 | .stdout()
at Object.end (node_modules/fancy-test/lib/base.js:84:24)
at test/commands/validate.test.ts:42:12
at test/commands/validate.test.ts:16:5
at Object.<anonymous> (test/commands/validate.test.ts:15:1)
● validate › with no arguments › throws error message if no current context
expect(received).toEqual(expected) // deep equality
Expected: ""
Received: "File asyncapi.yaml successfully validated!
"
91 | afterEach(() => {
92 | testHelper.setCurrentContext('home');
> 93 | testHelper.deleteDummyContextFile();
| ^
94 | });
95 |
96 | test
at Object.<anonymous> (test/commands/validate.test.ts:93:32)
at Object.run (node_modules/fancy-test/lib/base.js:44:38)
at Object.run (node_modules/fancy-test/lib/base.js:68:36)
● validate › with no arguments › throws error message if no context file exists
expect(received).toEqual(expected) // deep equality
Expected: ""
Received: "File asyncapi.yaml successfully validated!
"
100 | .it('validates from current context', (ctx, done) => {
101 | expect(ctx.stdout).toEqual(
> 102 | `File ${path.resolve(__dirname, '../specification.yml')} successfully validated!\n`
| ^
103 | );
104 | expect(ctx.stderr).toEqual('');
105 | done();
at Object.<anonymous> (test/commands/validate.test.ts:102:32)
at Object.run (node_modules/fancy-test/lib/base.js:44:38)
at Object.run (node_modules/fancy-test/lib/base.js:68:36)
FAIL test/commands/convert.test.ts (16.359 s)
● convert › with file paths › works when url is passed
thrown: "Exceeded timeout of 10000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
41 | .stderr()
42 | .stdout()
> 43 | .command(['convert', 'https://bit.ly/asyncapi'])
| ^
44 | .it('works when url is passed', (ctx, done) => {
45 | expect(ctx.stdout).toContain('URL https://bit.ly/asyncapi successfully converted!\n');
46 | expect(ctx.stderr).toEqual('');
at Object.end (node_modules/fancy-test/lib/base.js:84:24)
at test/commands/convert.test.ts:43:12
at test/commands/convert.test.ts:17:5
at Object.<anonymous> (test/commands/convert.test.ts:16:1)
● convert › with no arguments › throws error message if no current context
expect(received).toEqual(expected) // deep equality
Expected: ""
Received: "File asyncapi.yaml successfully converted!
asyncapi: 2.5.0
info:
title: Account Service
version: 1.0.0
description: This service is in charge of processing user signups
channels:
user/signedup:
subscribe:
message:
$ref: '#/components/messages/UserSignedUp'
components:
messages:
UserSignedUp:
payload:
type: object
properties:
displayName:
type: string
description: Name of the user
email:
type: string
format: email
description: Email of the user·
"
68 | done();
69 | });
> 70 |
| ^
71 | test
72 | .stderr()
73 | .stdout()
at Object.<anonymous> (test/commands/convert.test.ts:70:32)
at Object.run (node_modules/fancy-test/lib/base.js:44:38)
at Object.run (node_modules/fancy-test/lib/base.js:68:36)
● convert › with no arguments › throws error message if no context file exists
expect(received).toEqual(expected) // deep equality
Expected: ""
Received: "File asyncapi.yaml successfully converted!
asyncapi: 2.5.0
info:
title: Account Service
version: 1.0.0
description: This service is in charge of processing user signups
channels:
user/signedup:
subscribe:
message:
$ref: '#/components/messages/UserSignedUp'
components:
messages:
UserSignedUp:
payload:
type: object
properties:
displayName:
type: string
description: Name of the user
email:
type: string
format: email
description: Email of the user·
"
77 | })
78 | .command(['convert'])
> 79 | .it('throws error message if no current context', (ctx, done) => {
| ^
80 | expect(ctx.stdout).toEqual('');
81 | expect(ctx.stderr).toEqual('ContextError: No context is set as current, please set a current context.\n');
82 | done();
at Object.<anonymous> (test/commands/convert.test.ts:79:32)
at Object.run (node_modules/fancy-test/lib/base.js:44:38)
at Object.run (node_modules/fancy-test/lib/base.js:68:36)
FAIL test/commands/generate/models.test.ts (11.338 s)
● models › works with remote AsyncAPI files
thrown: "Exceeded timeout of 10000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
19 | test
20 | .stderr()
> 21 | .stdout()
| ^
22 | .command([...generalOptions, 'random', './test/specification.yml', `-o=${ path.resolve(outputDir, './random')}`])
23 | .it('fails when it dont know the language', (ctx, done) => {
24 | expect(ctx.stderr).toEqual('Error: Expected random to be one of: typescript, csharp, golang, java, javascript, dart, python, rust\nSee more help with --help\n');
at Object.end (node_modules/fancy-test/lib/base.js:84:24)
at test/commands/generate/models.test.ts:21:8
at Object.<anonymous> (test/commands/generate/models.test.ts:16:1)
PASS test/commands/diff.test.ts (5.339 s)
PASS test/commands/context.test.ts
PASS test/commands/new.test.ts
-----------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------------------|---------|----------|---------|---------|-------------------
All files | 3.54 | 0.88 | 2.79 | 3.71 |
src | 0 | 0 | 0 | 0 |
base.ts | 0 | 0 | 0 | 0 | 5-10
flags.ts | 0 | 0 | 0 | 0 | 3-4
globals.ts | 0 | 0 | 0 | 0 | 6-47
index.ts | 0 | 100 | 0 | 0 | 7-8
src/commands | 0 | 0 | 0 | 0 |
convert.ts | 0 | 0 | 0 | 0 | 15-61
diff.ts | 0 | 0 | 0 | 0 | 18-201
new.ts | 0 | 0 | 0 | 0 | 8-133
validate.ts | 0 | 0 | 0 | 0 | 9-40
src/commands/config | 0 | 100 | 0 | 0 |
index.ts | 0 | 100 | 0 | 0 | 4-9
src/commands/config/context | 0 | 100 | 0 | 0 |
add.ts | 0 | 100 | 0 | 0 | 5-22
current.ts | 0 | 100 | 0 | 0 | 5-13
index.ts | 0 | 100 | 0 | 0 | 6-8
list.ts | 0 | 100 | 0 | 0 | 5-14
remove.ts | 0 | 100 | 0 | 0 | 5-21
use.ts | 0 | 100 | 0 | 0 | 5-20
src/commands/generate | 0 | 0 | 0 | 0 |
fromTemplate.ts | 0 | 0 | 0 | 0 | 17-288
index.ts | 0 | 100 | 0 | 0 | 4-8
models.ts | 0 | 0 | 0 | 0 | 6-181
src/commands/start | 0 | 0 | 0 | 0 |
index.ts | 0 | 100 | 0 | 0 | 4-8
studio.ts | 0 | 0 | 0 | 0 | 6-22
src/errors | 5.19 | 0 | 0 | 5.33 |
context-error.ts | 18.75 | 100 | 0 | 21.42 | 13-35
diff-error.ts | 0 | 100 | 0 | 0 | 3-13
generator-error.ts | 0 | 100 | 0 | 0 | 4-6
specification-file.ts | 3.84 | 0 | 0 | 3.84 | 4-50
validation-error.ts | 0 | 0 | 0 | 0 | 11-57
src/models | 11.67 | 2.98 | 7.27 | 11.76 |
Context.ts | 14.54 | 14.28 | 7.14 | 13.46 | 23-104
SpecificationFile.ts | 16.85 | 0 | 13.04 | 18.07 | 20-62,78-178
Studio.ts | 0 | 0 | 0 | 0 | 10-122
src/utils | 0 | 0 | 0 | 0 |
generator.ts | 0 | 0 | 0 | 0 | 5-151
-----------------------------|---------|----------|---------|---------|-------------------
Test Suites: 4 failed, 3 passed, 7 total
Tests: 8 failed, 47 passed, 55 total
Snapshots: 1 passed, 1 total
Time: 93.756 s
Ran all test suites.
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From test/commands/validate.test.ts.
14 | catch (e) {
15 | if (e instanceof Error) {
> 16 | this.logToStderr(`${e.name}: ${e.message}`);
| ^
17 | process.exitCode = 1;
18 | }
19 | }
at Validate.catch (node_modules/@oclif/core/lib/command.js:160:31)
at Validate.<anonymous> (lib/base.js:16:43)
at node_modules/tslib/tslib.js:118:75
at Object.__awaiter (node_modules/tslib/tslib.js:114:16)
at Validate.catch (lib/base.js:14:24)
at Validate._run (node_modules/@oclif/core/lib/command.js:84:29)
at async Config.runCommand (node_modules/@oclif/core/lib/config/config.js:272:25)
at async Object.run (node_modules/@oclif/test/lib/command.js:21:28)
at async Object.run (node_modules/fancy-test/lib/base.js:68:25)
error loading AsyncAPI document from url: Failed to download https://bit.ly/asyncapi.
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From test/commands/validate.test.ts.
at node_modules/@oclif/core/lib/config/config.js:213:27
at Array.map (<anonymous>)
at Config.runHook (node_modules/@oclif/core/lib/config/config.js:212:39)
at Config.runCommand (node_modules/@oclif/core/lib/config/config.js:273:20)
at async Object.run (node_modules/@oclif/test/lib/command.js:21:28)
at async Object.run (node_modules/fancy-test/lib/base.js:68:25)
TypeError: require(...) is not a function
at /Users/postman/Documents/GitHub/cli/node_modules/@oclif/core/lib/config/config.js:213:43
at Array.map (<anonymous>)
at Config.runHook (/Users/postman/Documents/GitHub/cli/node_modules/@oclif/core/lib/config/config.js:212:39)
at Config.runCommand (/Users/postman/Documents/GitHub/cli/node_modules/@oclif/core/lib/config/config.js:273:20)
at Object.run (/Users/postman/Documents/GitHub/cli/node_modules/@oclif/test/lib/command.js:21:28)
at Object.run (/Users/postman/Documents/GitHub/cli/node_modules/fancy-test/lib/base.js:68:25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment