mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-10-31 20:13:43 +00:00 
			
		
		
		
	Compare commits
	
		
			19 Commits
		
	
	
		
			v5.10.2
			...
			setup-karm
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 292e1b4d15 | ||
|  | 64a12dca09 | ||
|  | d1d19327ba | ||
|  | dc6a1c3c0b | ||
|  | 63005d20ca | ||
|  | 600e8acdfa | ||
|  | 3f01774d0a | ||
|  | 808dffd2ed | ||
|  | 6b51f6d9a6 | ||
|  | 36342145da | ||
|  | 7b639129b3 | ||
|  | 89ae4585e6 | ||
|  | 469b827425 | ||
|  | 7feb0e4280 | ||
|  | 8cd8bac6a7 | ||
|  | ce1e902e89 | ||
|  | 3baa2c6ca5 | ||
|  | 2114ccfb40 | ||
|  | c6f1f99fe9 | 
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -26,6 +26,7 @@ yarn-error.log* | |||||||
| config.gypi | config.gypi | ||||||
|  |  | ||||||
| # Test generated files | # Test generated files | ||||||
| tests/package.json | tests/e2e/package.json | ||||||
|  | coverage | ||||||
|  |  | ||||||
| .python-version | .python-version | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ os: Previous Visual Studio 2015 | |||||||
|  |  | ||||||
| cache: | cache: | ||||||
|   - node_modules |   - node_modules | ||||||
|    |  | ||||||
| install: | install: | ||||||
|   - ps: Install-Product node 6 x64 |   - ps: Install-Product node 6 x64 | ||||||
|   - git reset --hard HEAD |   - git reset --hard HEAD | ||||||
| @@ -20,5 +20,4 @@ install: | |||||||
| build: off | build: off | ||||||
|  |  | ||||||
| test_script: | test_script: | ||||||
|   - npm run test |   - npm run test-all | ||||||
|   - npm run test-e2e |  | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ gulp.task('reload:renderer', done => { | |||||||
| }); | }); | ||||||
|  |  | ||||||
| gulp.task('test-e2e', () => { | gulp.task('test-e2e', () => { | ||||||
| 	return gulp.src('tests/*.js') | 	return gulp.src('tests/e2e/*.js') | ||||||
| 	.pipe(tape({ | 	.pipe(tape({ | ||||||
| 		reporter: tapColorize() | 		reporter: tapColorize() | ||||||
| 	})); | 	})); | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								karma.conf.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								karma.conf.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | module.exports = function (config) { | ||||||
|  | 	config.set({ | ||||||
|  | 		basePath: '', | ||||||
|  | 		frameworks: ['jasmine'], | ||||||
|  | 		browsers: ['Electron'], | ||||||
|  | 		preprocessors: { | ||||||
|  | 			'**/*.js': ['electron'] | ||||||
|  | 		}, | ||||||
|  | 		files: [ | ||||||
|  | 			{pattern: './karma.shim.js', watched: true, included: true, served: true}, | ||||||
|  | 			{pattern: './tests/unit/*.js', watched: true, included: true, served: true}, | ||||||
|  | 			{pattern: './app/renderer/**/*.js', watched: true, included: false, served: true} | ||||||
|  | 		], | ||||||
|  | 		reporters: ['mocha'], | ||||||
|  | 		client: { | ||||||
|  | 			captureConsole: true, | ||||||
|  | 			useIframe: false | ||||||
|  | 		}, | ||||||
|  | 		singleRun: true | ||||||
|  | 	}); | ||||||
|  | }; | ||||||
							
								
								
									
										5
									
								
								karma.shim.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								karma.shim.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | window.require = window.parent.require; | ||||||
|  | window.process = window.parent.process; | ||||||
|  | window.__dirname = window.parent.__dirname; | ||||||
|  | require('module').globalPaths.push('./node_modules'); | ||||||
|  | require('module').globalPaths.push('./app/renderer'); | ||||||
							
								
								
									
										16
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								package.json
									
									
									
									
									
								
							| @@ -21,8 +21,10 @@ | |||||||
|     "start": "electron app --disable-http-cache", |     "start": "electron app --disable-http-cache", | ||||||
|     "reinstall": "rm -rf node_modules; rm -rf app/node_modules; npm install", |     "reinstall": "rm -rf node_modules; rm -rf app/node_modules; npm install", | ||||||
|     "postinstall": "electron-builder install-app-deps", |     "postinstall": "electron-builder install-app-deps", | ||||||
|     "test": "xo", |     "lint": "xo", | ||||||
|     "test-e2e": "gulp test-e2e", |     "test-e2e": "gulp test-e2e", | ||||||
|  |     "test-unit": "karma start karma.conf.js", | ||||||
|  |     "test-all": "xo && npm run test-unit && npm run test-e2e", | ||||||
|     "dev": "gulp dev", |     "dev": "gulp dev", | ||||||
|     "pack": "electron-builder --dir", |     "pack": "electron-builder --dir", | ||||||
|     "dist": "electron-builder", |     "dist": "electron-builder", | ||||||
| @@ -30,7 +32,7 @@ | |||||||
|     "travis": "cd ./scripts && ./travis-build-test.sh" |     "travis": "cd ./scripts && ./travis-build-test.sh" | ||||||
|   }, |   }, | ||||||
|   "pre-commit": [ |   "pre-commit": [ | ||||||
|     "test" |     "lint" | ||||||
|   ], |   ], | ||||||
|   "build": { |   "build": { | ||||||
|     "appId": "org.zulip.zulip-electron", |     "appId": "org.zulip.zulip-electron", | ||||||
| @@ -116,10 +118,17 @@ | |||||||
|     "gulp": "3.9.1", |     "gulp": "3.9.1", | ||||||
|     "gulp-tape": "0.0.9", |     "gulp-tape": "0.0.9", | ||||||
|     "is-ci": "^1.0.10", |     "is-ci": "^1.0.10", | ||||||
|  |     "jasmine": "^2.8.0", | ||||||
|  |     "karma": "^1.7.1", | ||||||
|  |     "karma-electron": "^5.2.2", | ||||||
|  |     "karma-electron-launcher": "^0.2.0", | ||||||
|  |     "karma-jasmine": "^1.1.0", | ||||||
|  |     "karma-mocha-reporter": "^2.2.5", | ||||||
|     "pre-commit": "1.2.2", |     "pre-commit": "1.2.2", | ||||||
|     "spectron": "3.7.2", |     "spectron": "3.7.2", | ||||||
|     "tap-colorize": "^1.2.0", |     "tap-colorize": "^1.2.0", | ||||||
|     "tape": "^4.8.0", |     "tape": "^4.8.0", | ||||||
|  |     "watchify": "^3.9.0", | ||||||
|     "xo": "0.18.2" |     "xo": "0.18.2" | ||||||
|   }, |   }, | ||||||
|   "xo": { |   "xo": { | ||||||
| @@ -153,7 +162,8 @@ | |||||||
|       } |       } | ||||||
|     ], |     ], | ||||||
|     "ignore": [ |     "ignore": [ | ||||||
|       "tests/*.js" |       "tests/e2e/*.js", | ||||||
|  |       "tests/unit/*" | ||||||
|     ], |     ], | ||||||
|     "envs": [ |     "envs": [ | ||||||
|       "node", |       "node", | ||||||
|   | |||||||
| @@ -10,8 +10,14 @@ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then | |||||||
|     xdpyinfo | grep dimensions |     xdpyinfo | grep dimensions | ||||||
| fi | fi | ||||||
|  |  | ||||||
| npm run test | # macOS | ||||||
|  | # Run all the tests | ||||||
| if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||||||
|     npm run test-e2e |     npm run test-all | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # Linux | ||||||
|  | # Only run linting test on Linux | ||||||
|  | if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then | ||||||
|  |     npm run lint | ||||||
| fi | fi | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ module.exports = { | |||||||
| function createApp (t) { | function createApp (t) { | ||||||
|   generateTestAppPackageJson() |   generateTestAppPackageJson() | ||||||
|   return new Application({ |   return new Application({ | ||||||
|     path: path.join(__dirname, '..', 'node_modules', '.bin', |     path: path.join(__dirname,'..', '..', 'node_modules', '.bin', | ||||||
|       'electron' + (process.platform === 'win32' ? '.cmd' : '')), |       'electron' + (process.platform === 'win32' ? '.cmd' : '')), | ||||||
|     args: [path.join(__dirname)], // Ensure this dir has a package.json file with a 'main' entry piont
 |     args: [path.join(__dirname)], // Ensure this dir has a package.json file with a 'main' entry piont
 | ||||||
|     env: {NODE_ENV: 'test'}, |     env: {NODE_ENV: 'test'}, | ||||||
| @@ -34,9 +34,9 @@ function createApp (t) { | |||||||
| // Reads app package.json and updates the productName to config.TEST_APP_PRODUCT_NAME 
 | // Reads app package.json and updates the productName to config.TEST_APP_PRODUCT_NAME 
 | ||||||
| // We do this so that the app integration doesn't doesn't share the same appDataDir as the dev application
 | // We do this so that the app integration doesn't doesn't share the same appDataDir as the dev application
 | ||||||
| function generateTestAppPackageJson () { | function generateTestAppPackageJson () { | ||||||
|   let packageJson = require(path.join(__dirname, '../package.json')) |   let packageJson = require(path.join(__dirname, '..', '..', 'package.json')) | ||||||
|   packageJson.productName = config.TEST_APP_PRODUCT_NAME |   packageJson.productName = config.TEST_APP_PRODUCT_NAME | ||||||
|   packageJson.main = '../app/main' |   packageJson.main = '../../app/main' | ||||||
| 
 | 
 | ||||||
|   const testPackageJsonPath = path.join(__dirname, 'package.json') |   const testPackageJsonPath = path.join(__dirname, 'package.json') | ||||||
|   fs.writeFileSync(testPackageJsonPath, JSON.stringify(packageJson, null, ' '), 'utf-8') |   fs.writeFileSync(testPackageJsonPath, JSON.stringify(packageJson, null, ' '), 'utf-8') | ||||||
							
								
								
									
										20
									
								
								tests/unit/test-spellchecker.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								tests/unit/test-spellchecker.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | const ConfigUtil = require('js/utils/config-util.js'); | ||||||
|  | const SetupSpellChecker = require('js/spellchecker') | ||||||
|  |  | ||||||
|  | describe('test spell checker', function () { | ||||||
|  |   // enable spellchecker settings | ||||||
|  |   ConfigUtil.setConfigItem('enableSpellchecker', true); | ||||||
|  |   ConfigUtil.setConfigItem('spellcheckerLanguage', 'en'); | ||||||
|  |  | ||||||
|  |   SetupSpellChecker.init()  // re-initialize after setting update | ||||||
|  |  | ||||||
|  |   const spellCheckHandler = SetupSpellChecker.SpellCheckHandler | ||||||
|  |  | ||||||
|  |   it('mark misspelled word', function () { | ||||||
|  |     expect(spellCheckHandler.isMisspelled('helpe')).toBe(true) | ||||||
|  |   }) | ||||||
|  |  | ||||||
|  |   it('verify properly spelled word', function () { | ||||||
|  |     expect(spellCheckHandler.isMisspelled('help')).toBe(false) | ||||||
|  |   }) | ||||||
|  | }) | ||||||
		Reference in New Issue
	
	Block a user