Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create documentation when using @jest-env #548

Open
5 tasks done
DamickDoni opened this issue Jul 30, 2019 · 1 comment
Open
5 tasks done

Can't create documentation when using @jest-env #548

DamickDoni opened this issue Jul 30, 2019 · 1 comment

Comments

@DamickDoni
Copy link

Make sure these boxes are checked before submitting your issue - thank you!
(If your issue is neither a both bug nor a request, please write in a free style)

Short summary of your issue

When using a jest test with jsdom as test-enviroment (@jest-enviroment), the documentation cannot be created.

Input data for reproducing

Configuration

{
            "name": "esdoc-standard-plugin",
            "option": {
                "test": {
                    "source": "./src",
                    "interfaces": [
                        "describe",
                        "it",
                        "context",
                        "suite",
                        "test"
                    ],
                    "includes": ["(spec|Spec|test|Test)\\.ts$"]
                },
..

Codes

/**
 * @jest-environment jsdom
 */
import 'whatwg-fetch';

describe('request', () => {
    beforeEach(() => {
        window.fetch = jest.fn();
    });
...

Output data

Log

{ SyntaxError: Unexpected token (18:13)
    at Parser.pp$5.raise (/src/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/src/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/src/node_modules/babylon/lib/index.js:3750:12)
    at Parser.pp$3.parseExprSubscripts (/src/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/src/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/src/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/src/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/src/node_modules/babylon/lib/index.js:3344:19)
    at Parser.pp$3.parseParenAndDistinguishExpression (/src/node_modules/babylon/lib/index.js:3828:26)
    at Parser.pp$3.parseExprAtom (/src/node_modules/babylon/lib/index.js:3709:19) pos: 480, loc: Position { line: 18, column: 13 } }
/src/node_modules/esdoc/out/src/Factory/DocFactory.js:135
    for (const exportNode of this._ast.program.body) {
                                       ^

TypeError: Cannot read property 'program' of undefined
    at DocFactory._inspectExportDefaultDeclaration (/src/node_modules/esdoc/out/src/Factory/DocFactory.js:135:40)
    at new DocFactory (/src/node_modules/esdoc/out/src/Factory/DocFactory.js:90:10)
    at Function._traverse (/src/node_modules/esdoc/out/src/ESDoc.js:233:21)
    at _walk.filePath (/src/node_modules/esdoc/out/src/ESDoc.js:112:25)
    at Function._walk (/src/node_modules/esdoc/out/src/ESDoc.js:204:9)
    at Function._walk (/src/node_modules/esdoc/out/src/ESDoc.js:206:14)
    at Function._walk (/src/node_modules/esdoc/out/src/ESDoc.js:206:14)
    at Function.generate (/src/node_modules/esdoc/out/src/ESDoc.js:96:10)
    at ESDocCLI.exec (/src/node_modules/esdoc/out/src/ESDocCLI.js:71:23)
    at Object.<anonymous> (/src/node_modules/esdoc/out/src/ESDocCLI.js:182:7)

Your environment

  • OS type and version: Ubuntu 16.
  • Node.js version: 10.16.0
  • ESDoc version: 1.1.0
@mstruensee
Copy link

why would you want docs generated for test files, just exclude them...

	excludes: [
		"\\.test\\.js$",
	],

^^ what I do ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants