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

[Jasmine] Jest with testRunner: jasmine2 - test run fails because of an undefined spec.filename #1169

Closed
delatrie opened this issue Oct 14, 2024 · 1 comment
Labels
theme:jasmine Jasmine related issue type:bug Something isn't working

Comments

@delatrie
Copy link
Collaborator

Describe the bug
When using allure-jasmine with Jest, the following error is thrown:

TypeError: The "path" argument must be of type string. Received undefined
        at Object.isAbsolute (node:path:435:5)
        at isAbsolute (C:\Users\madam\repos\jasmine-test\node_modules\allure-js-commons\src\sdk\reporter\utils.ts:105:12)
        at getPackageLabel (C:\Users\madam\repos\jasmine-test\node_modules\allure-js-commons\src\sdk\reporter\utils\labels.ts:49:25)
        at C:\Users\madam\repos\jasmine-test\node_modules\allure-jasmine\src\index.ts:156:41
        at ReporterRuntime.updateFunc (C:\Users\madam\repos\jasmine-test\node_modules\allure-js-commons\src\sdk\reporter\ReporterRuntime.ts:226:5)
        at AllureJasmineReporter.updateTest [as specDone] (C:\Users\madam\repos\jasmine-test\node_modules\allure-jasmine\src\index.ts:147:24)
        at dispatch (C:\Users\madam\repos\jasmine-test\node_modules\jest-jasmine2\build\jasmine\ReportDispatcher.js:87:28)
        at ReportDispatcher.specDone (C:\Users\madam\repos\jasmine-test\node_modules\jest-jasmine2\build\jasmine\ReportDispatcher.js:63:11)
        at Object.specResultCallback (C:\Users\madam\repos\jasmine-test\node_modules\jest-jasmine2\build\jasmine\Env.js:429:20)
        at Spec.attr.resultCallback (C:\Users\madam\repos\jasmine-test\node_modules\jest-jasmine2\build\setup_jest_globals.js:60:26)
        at complete (C:\Users\madam\repos\jasmine-test\node_modules\jest-jasmine2\build\jasmine\Spec.js:172:12)
        at C:\Users\madam\repos\jasmine-test\node_modules\jest-jasmine2\build\jasmine\Spec.js:169:32

The test run then hangs until ctrl+C is pressed.

To Reproduce
Steps to reproduce the behavior:

  1. npx install --save-dev jest jest-jasmine2 allure-jasmine
  2. In jest.config.json:
    {
        "testRunner": "jasmine2",
        "setupFilesAfterEnv": [
            "./spec/helpers/allure.js"
        ]
    }
  3. In ./spec/helpers/allure.js:
    const AllureJasmineReporter = require("allure-jasmine");
    
    jasmine.getEnv().addReporter(
      new AllureJasmineReporter(),
    );
  4. Add a spec file.
  5. npx jest
  6. Observe the error.

Expected behavior
No error; test results are generated.

Desktop (please complete the following information):

@delatrie delatrie added type:bug Something isn't working theme:jasmine Jasmine related issue labels Oct 14, 2024
@delatrie
Copy link
Collaborator Author

Duplicate of #1168

@delatrie delatrie marked this as a duplicate of #1168 Oct 14, 2024
@delatrie delatrie closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:jasmine Jasmine related issue type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant