-
Notifications
You must be signed in to change notification settings - Fork 161
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
{random = false} has unexpected behaviour #226
Comments
Switch back to an older version of Jasmine. Your problem should be fixed in
the next release, when we support 3.3.
…On Thu, Nov 8, 2018, 12:51 AM DmitryAstafyev ***@***.*** wrote:
Fail to run tests in strict order.
package.json
{
"version": "0.0.1",
"description": "",
"main": "./src/main.ts",
"scripts": {
},
"devDependencies": {
***@***.***/jasmine": "^2.8.9",
"concurrently": "^4.0.1",
"jasmine": "^3.3.0",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"jasmine-ts": "^0.3.0",
"karma": "^3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-typescript": "^3.0.13",
"karma-webpack": "^3.0.5",
"lite-server": "^2.4.0",
"source-map-loader": "^0.2.4",
"ts-loader": "^5.2.2",
"typescript": "^3.1.3",
"webpack": "^4.23.1"
},
"dependencies": {}
}
karma.config.ts
const webpackConfig = require('./webpack.config');
delete webpackConfig.entry;
webpackConfig.mode = "development";
webpackConfig.devtool = 'inline-source-map';
module.exports = function(config) {
config.set({
frameworks: ["jasmine", "karma-typescript"],
files: [
"spec/client.spec.ts",
{ pattern: './build/*.css', watched: true, served: true, included: true },
],
preprocessors: {
"**/*.ts": ['webpack', 'sourcemap']
},
webpack: webpackConfig,
reporters: ["progress", "kjhtml"],
browsers: ["Chrome"],
karmaTypescriptConfig: {
"compilerOptions": {
"target": "es6",
"lib": ["es5", "es6", "dom"],
}
},
/*
client: {
jasmine: {
random: false
}
}
*/
});
};
Test (spec/client.spec.ts)
/// <reference ***@***.***/jasmine/index.d.ts" />
jasmine.DEFAULT_TIMEOUT_INTERVAL = 900000;
console.log('Init');
describe('[client]', () => {
console.log('Spec declarations');
it('[Test 1]', (done) => {
console.log('Test 1: started');
// Async stuff here
// ...
// ...
expect(true).toBe(true);
done();
});
it('[Test 2]', (done) => {
console.log('Test 2: started');
// Async stuff here
// ...
// ...
expect(true).toBe(true);
done();
});
it('[Test 3]', (done) => {
console.log('Test 3: started');
// Async stuff here
// ...
// ...
expect(true).toBe(true);
done();
});
it('[Test 4]', (done) => {
console.log('Test 4: started');
// Async stuff here
// ...
// ...
expect(true).toBe(true);
done();
});
});
The situation is next. If I comment out in karma.config.js settings of
jasmine: everything works, but all tests are running in random order.
As results I see the output in browser console:
Init
Spec declarations
Test 4: started
Test 1: started
Test 2: started
Test 3: started
The thing is I need a strict order of test's executing: 1, 2, 3 and 4.
If I add settings for jasmine like:
client: { jasmine: { random: false } }
tests didn't run at all. And in the output of browser console I see only:
init
Spec declarations
All tests work asynchronously.
I've killed tons of time, would be great if someone advice solution.
Related:
https://stackoverflow.com/questions/53199798/karma-jasmin-ordered-test-running
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#226>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAMjAr_hw9For0LMTNJo4aXax2v5Dt84ks5us_CUgaJpZM4YUPPn>
.
|
I think this is fixed now. My project has below dependencies and I am able to run my tests in order consistently, without the previous EDIT: Yes it looks like it's been fixed in #224
|
Thanks for the update! |
setting random to false not working when I try it to set in my project upgraded in angular 10 package.json:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fail to run tests in strict order.
package.json
karma.config.ts
Test (spec/client.spec.ts)
The situation is next. If I comment out in karma.config.js settings of jasmine: everything works, but all tests are running in random order.
As results I see the output in browser console:
The thing is I need a strict order of test's executing: 1, 2, 3 and 4.
If I add settings for jasmine like:
client: { jasmine: { random: false } }
tests didn't run at all. And in the output of browser console I see only:
All tests work asynchronously.
I've killed tons of time, would be great if someone advice solution.
Related: https://stackoverflow.com/questions/53199798/karma-jasmin-ordered-test-running
The text was updated successfully, but these errors were encountered: