Open vjuturu opened 5 years ago
I have the same problem. Any solution to it?
Don't faced with such error yet. Could you provide more information ? (better link to demo project somewhere on github).
Btw, here is demo project with jest-alure integration https://github.com/zaqqaz/visual-unit-tests/blob/master/src/setupTests.ts
just clone it and try it yourself.
Show your version of jest @vjuturu.
And try to add something as setupFilesAfterEnv: ["jest-allure/dist/setup"]
in your jest.config.js;
Now i will check compatibility jest-allure with the latest jest and will try to get PR because i think that jest-allure not up to date
resolved in #15
Versions "jest": "^24.8.0", "jest-allure": "^0.1.1",
jest.config.js
module.exports = {
reporters: ["default", "jest-allure","jest-stare"],
setupFilesAfterEnv: ["jest-allure/dist/setup"]
};
FAIL src/home/example.test.ts
● Test suite failed to run
Your test suite must contain at least one test.
at node_modules/@jest/core/build/TestScheduler.js:242:24
at asyncGeneratorStep (node_modules/@jest/core/build/TestScheduler.js:131:24)
at _next (node_modules/@jest/core/build/TestScheduler.js:151:9)
at node_modules/@jest/core/build/TestScheduler.js:156:7
at node_modules/@jest/core/build/TestScheduler.js:148:12
at onResult (node_modules/@jest/core/build/TestScheduler.js:271:25)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.329s
Ran all test suites.
I have tests, those are the results if i remove setupFilesAfterEnv from jest config file
PASS src/home/example.test.ts
✓ example testing (3ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.354s
Ran all test suites.
@kevinoliveira can you attach the source of src/home/example.test.ts?
src/home/example.ts
const example = ()=>"this is a example!";
export {example}
src/home/example.test.ts
import { example} from "./example";
test(
"example testing",
() => expect(example()).toBe("this is a example!")
);
I am also getting error:
● Test suite failed to run
ReferenceError: jasmine is not defined
at registerAllureReporter (node_modules/jest-allure/dist/setup.js:46:5)
at Object.<anonymous> (node_modules/jest-allure/dist/setup.js:49:1)
at Array.forEach (<anonymous>)
jest.config.js
...
setupFilesAfterEnv: ['jest-allure/dist/setup'],
reporters: [
'default',
'jest-github-reporter',
...
package.json
...
"devDependencies": {
"jasmine": "^3.5.0",
"jest-allure": "^0.1.1",
...
}
tests/main.ts
import { wait } from '../src/wait';
import process from 'process';
import cp from 'child_process';
import path from 'path';
test('throws invalid number', async () => {
const input = parseInt('foo', 10);
await expect(wait(input)).rejects.toThrow('milliseconds not a number');
});
test('wait 500 ms', async () => {
const start = new Date();
await wait(500);
const end = new Date();
const delta = Math.abs(end.getTime() - start.getTime());
expect(delta).toBeGreaterThan(450);
});
// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['INPUT_MILLISECONDS'] = '500';
const ip = path.join(__dirname, '..', 'lib', 'main.js');
const options: cp.ExecSyncOptions = {
env: process.env,
};
console.log(cp.execSync(`node ${ip}`, options).toString());
});
EDIT:
Looks like it's because of testRunner: 'jest-circus/runner'
EDIT2:
@kevinoliveira Looks like I'm actually having the same problem (which is I think different that this one) over in #43.
@kevinoliveira Hello, I have the same issue as you had, I am curious if you solved it? I am using jest 25.1.0
@kevinoliveira Hello, I have the same issue as you had, I am curious if you solved it?
Hi, I had the same situation and found no one answer wich worked for me. Now I using another way. I added this row for jest.config.js testRunner : 'jasmine2'
it's resolve issue with ReferenceError: jasmine is not defined at registerAllureReporter
and report generate successed
Awesome news, I will take a look on the next few days!
Yep, that's the correct solution. https://github.com/zaqqaz/jest-allure#uses-jest-circus-or-jest--v-27-
@kevinoliveira Hello, I have the same issue as you had, I am curious if you solved it?
Hi, I had the same situation and found no one answer wich worked for me. Now I using another way. I added this row for jest.config.js testRunner : 'jasmine2'
it's resolve issue with ReferenceError: jasmine is not defined at registerAllureReporter
and report generate successed
Thanks! It works for me
Hi! I was able to fix the issue using:
testRunner : 'jasmine2',
into the jest config file:
module.exports = {
verbose: true,
preset: 'jest-playwright-preset',
testRunner : 'jasmine2',
transform:{
"^.+\\.tsx?$": "ts-jest",
},
testTimeout: 120000,
reporters: ["default", "jest-allure"],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
setupFilesAfterEnv: ['jest-allure/dist/setup','expect-playwright'],
testMatch: [
"**/tests/**/*.spec.(js|jsx|ts|tsx)",
// "**/tests/**/*.test.(js|jsx|ts|tsx)"
]
};
I'm using Jest 27 and testRunner : 'jasmine2'
didn't work for me
Instead I added this to my package.json and worked:
"jest": {
"testRunner": "jest-jasmine2"
}
I have Jest 29, adding, I tried several solutions, still does not work
I have Jest 29, adding, I tried several solutions, still does not work
@saritvakrat Try to install this package: jest-jasmine2
and set it to the file jest.config.js
: testRunner: "jest-jasmine2"
ReferenceError: jasmine is not defined at registerAllureReporter (/Users/xxxx/Projects/xxxx/xxxx/node_modules/jest-allure/dist/setup.js:46:5)
Steps followed:
please advise.
Thanks --vj