Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Jest #3724

Merged
merged 16 commits into from
Jan 9, 2020
Merged

Jest #3724

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,20 @@ steps:
image: "matrixdotorg/riotweb-ci-e2etests-env:latest"
propagate-environment: true

- label: ":karma: Tests"
- label: ":jest: Tests"
agents:
# We use a medium sized instance instead of the normal small ones because
# webpack loves to gorge itself on resources.
queue: "medium"
command:
# Install chrome
- "echo '--- Installing Chrome'"
- "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -"
- "sh -c 'echo \"deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google.list'"
- "apt-get update"
- "apt-get install -y google-chrome-stable"
# Run tests
# TODO: Remove hacky chmod for BuildKite
- "chmod +x ./scripts/ci/*.sh"
- "chmod +x ./scripts/*"
- "echo '--- Installing Dependencies'"
- "./scripts/ci/install-deps.sh"
- "echo '+++ Running Tests'"
- "./scripts/ci/unit-tests.sh"
env:
CHROME_BIN: "/usr/bin/google-chrome-stable"
- "yarn test"
plugins:
- docker#v3.0.1:
image: "node:10"
Expand Down
16 changes: 16 additions & 0 deletions __mocks__/browser-request.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const en = require("../src/i18n/strings/en_EN");

module.exports = jest.fn((opts, cb) => {
if (opts.url.endsWith("languages.json")) {
cb(undefined, {status: 200}, JSON.stringify({
"en": {
"fileName": "en_EN.json",
"label": "English",
},
}));
} else if (opts.url.endsWith("en_EN.json")) {
cb(undefined, {status: 200}, JSON.stringify(en));
} else {
cb(undefined, {status: 404}, "");
}
});
1 change: 1 addition & 0 deletions __mocks__/imageMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "image-file-stub";
228 changes: 0 additions & 228 deletions karma.conf.js

This file was deleted.

28 changes: 12 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"git-revision.txt",
"header",
"jenkins.sh",
"karma.conf.js",
"lib",
"package.json",
"release.sh",
Expand Down Expand Up @@ -53,8 +52,7 @@
"stylelint": "stylelint 'res/css/**/*.scss'",
"clean": "rimraf lib",
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
"test": "karma start --single-run=true --browsers VectorChromeHeadless",
"test-multi": "karma start",
"test": "jest",
"e2etests": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
},
"dependencies": {
Expand Down Expand Up @@ -115,9 +113,11 @@
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@peculiar/webcrypto": "^1.0.22",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-builtin-extend": "^1.1.2",
Expand All @@ -139,32 +139,28 @@
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-hooks": "^2.0.1",
"estree-walker": "^0.5.0",
"expect": "^24.1.0",
"file-loader": "^3.0.1",
"flow-parser": "^0.57.3",
"jest-mock": "^23.2.0",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-logcapture-reporter": "0.0.1",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.31",
"karma-summary-reporter": "^1.5.1",
"karma-webpack": "^4.0.0-beta.0",
"jest": "^23.2.0",
"matrix-mock-request": "^1.2.3",
"matrix-react-test-utils": "^0.2.2",
"mocha": "^5.0.5",
"react-test-renderer": "^16.9.0",
"require-json": "0.0.1",
"rimraf": "^2.4.3",
"sinon": "^5.0.7",
"source-map-loader": "^0.2.3",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.9.0",
"subtle": "^0.1.8",
"walk": "^2.3.9",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1"
},
"jest": {
"testMatch": ["<rootDir>/test/**/*-test.js"],
"setupTestFrameworkScriptFile": "<rootDir>/test/setupTests.js",
"moduleNameMapper": {
"\\.(gif|png|svg|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js"
}
}
}
10 changes: 0 additions & 10 deletions scripts/ci/unit-tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/views/settings/KeyBackupPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler';
import Modal from '../../../Modal';
import SettingsStore from '../../../../lib/settings/SettingsStore';
import SettingsStore from '../../../settings/SettingsStore';
import { accessSecretStorage } from '../../../CrossSigningManager';

export default class KeyBackupPanel extends React.PureComponent {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/MegolmExportEncryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export async function decryptMegolmKeyFile(data, password) {
* @param {String} data
* @param {String} password
* @param {Object=} options
* @param {Nunber=} options.kdf_rounds Number of iterations to perform of the
* @param {Number=} options.kdf_rounds Number of iterations to perform of the
* key-derivation function.
* @return {Promise<ArrayBuffer>} promise for encrypted output
*/
Expand Down
2 changes: 0 additions & 2 deletions test/DecryptionFailureTracker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import expect from 'expect';

import { DecryptionFailure, DecryptionFailureTracker } from '../src/DecryptionFailureTracker';

import { MatrixEvent } from 'matrix-js-sdk';
Expand Down
1 change: 0 additions & 1 deletion test/PhasedRollOut-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import expect from 'expect';
import {phasedRollOutExpiredForUser} from '../src/PhasedRollOut';

const OFFSET = 6000000;
Expand Down
Loading