Skip to content

Commit

Permalink
feat: update jest v20 to v24 (#243)
Browse files Browse the repository at this point in the history
* feat: update jest v20 to v24

* chore: jest.fn().mockReturnValue(null) -> jest.fn()

* chore: add jest.config.base.js which is read from all packages

* fix: fix local storage test
  • Loading branch information
trivikr authored May 9, 2019
1 parent a27fa86 commit 1e156ab
Show file tree
Hide file tree
Showing 280 changed files with 1,411 additions and 915 deletions.
4 changes: 4 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
// remove testMatch once we move to ts-jest
testMatch: ["**/__tests__/**/*.js?(x)", "**/?(*.)+(spec|test).js?(x)"]
};
18 changes: 18 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const base = require("./jest.config.base.js");

module.exports = {
...base,
projects: ["<rootDir>/packages/*/jest.config.js"],
testPathIgnorePatterns: [
"<rootDir>/packages/add-glacier-checksum-headers-browser",
"<rootDir>/packages/client-.*"
],
coveragePathIgnorePatterns: [
"/node_modules/",
"<rootDir>/packages/add-glacier-checksum-headers-browser",
"<rootDir>/packages/crypto-sjcl-*",
"<rootDir>/packages/xml-body-parser/vendor/",
"<rootDir>/packages/client-.*",
"/__fixtures__/"
]
};
21 changes: 2 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@types/jest": "^24.0.12",
"generate-changelog": "^1.7.1",
"husky": "^2.1.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"lerna": "3.13.4",
"lint-staged": "^8.1.5",
"prettier": "1.17.0",
Expand All @@ -38,24 +39,6 @@
"workspaces": [
"packages/*"
],
"jest": {
"mapCoverage": true,
"projects": [
"<rootDir>/packages/*"
],
"testPathIgnorePatterns": [
"<rootDir>/packages/add-glacier-checksum-headers-browser",
"<rootDir>/packages/client-.*"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"<rootDir>/packages/add-glacier-checksum-headers-browser",
"<rootDir>/packages/crypto-sjcl-*",
"<rootDir>/packages/xml-body-parser/vendor/",
"<rootDir>/packages/client-.*",
"/__fixtures__/"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
Expand Down
5 changes: 5 additions & 0 deletions packages/abort-controller/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/abort-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"jest": "^20.0.4",
"@types/jest": "^24.0.12",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
5 changes: 5 additions & 0 deletions packages/add-glacier-checksum-headers-browser/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/add-glacier-checksum-headers-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"devDependencies": {
"@aws-crypto/sha256-browser": "^0.1.0-preview.1",
"@aws-sdk/util-utf8-browser": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"jasmine-core": "^2.8.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.1",
Expand Down
5 changes: 5 additions & 0 deletions packages/add-glacier-checksum-headers-node/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/add-glacier-checksum-headers-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"devDependencies": {
"@aws-crypto/sha256-js": "^0.1.0-preview.1",
"@aws-sdk/util-utf8-node": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("addChecksumHeaders", () => {
hostname: "foo.us-east-1.amazonaws.com"
};

const mockNextHandler = jest.fn(() => Promise.resolve());
const mockNextHandler = jest.fn();

const composedHandler: BuildHandler<any, any, Readable> = addChecksumHeaders(
Sha256,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/add-glacier-checksum-headers-universal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
5 changes: 5 additions & 0 deletions packages/apply-body-checksum-middleware/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
6 changes: 3 additions & 3 deletions packages/apply-body-checksum-middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"prepublishOnly": "tsc",
"pretest": "tsc -p tsconfig.test.json",
"test": "jest --coverage --mapCoverage"
"test": "jest --coverage"
},
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand All @@ -20,8 +20,8 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"jest": "^20.0.4",
"@types/jest": "^24.0.12",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/apply-body-checksum-middleware/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { applyBodyChecksumMiddleware } from "./";
import { HashConstructor, HttpRequest } from "@aws-sdk/types";

describe("applyChecksumMiddleware", () => {
const mockEncoder = jest.fn(() => "encoded");
const mockHashUpdate = jest.fn(() => {});
const mockHashDigest = jest.fn(() => new Uint8Array(0));
const mockEncoder = jest.fn().mockReturnValue("encoded");
const mockHashUpdate = jest.fn();
const mockHashDigest = jest.fn().mockReturnValue(new Uint8Array(0));
const MockHash: HashConstructor = class {} as any;
MockHash.prototype.update = mockHashUpdate;
MockHash.prototype.digest = mockHashDigest;

const next = jest.fn(() => Promise.resolve({}));
const next = jest.fn();

class ExoticStream {}

Expand Down
5 changes: 5 additions & 0 deletions packages/bucket-endpoint-middleware/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/bucket-endpoint-middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"jest": "^20.0.4",
"@types/jest": "^24.0.12",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("bucketEndpointMiddleware", () => {
hostname: "s3.us-west-2.amazonaws.com",
path: "/bucket"
};
const next = jest.fn(() => Promise.resolve({}));
const next = jest.fn();

beforeEach(() => {
next.mockClear();
Expand Down
5 changes: 5 additions & 0 deletions packages/build-types/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
5 changes: 5 additions & 0 deletions packages/chunked-blob-reader/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/chunked-blob-reader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"jest": "^20.0.4",
"@types/jest": "^24.0.12",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
5 changes: 5 additions & 0 deletions packages/chunked-stream-reader-node/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const base = require("../../jest.config.base.js");

module.exports = {
...base
};
4 changes: 2 additions & 2 deletions packages/chunked-stream-reader-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"typescript": "^3.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/client-codecommit-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
},
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"rimraf": "^2.6.2",
"typedoc": "^0.10.0",
"typescript": "^3.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/client-documentation-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"prepublishOnly": "tsc",
"pretest": "tsc",
"test": "jest"
"test": "exit 0"
},
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand All @@ -22,9 +22,9 @@
"tslib": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"typedoc": "^0.10.0",
"typescript": "^3.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/client-dynamodb-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@aws-sdk/karma-credential-loader": "^0.1.0-preview.4",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"jasmine-core": "^2.8.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/client-dynamodb-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
},
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"rimraf": "^2.6.2",
"typedoc": "^0.10.0",
"typescript": "^3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/client-glacier-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
},
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"rimraf": "^2.6.2",
"typedoc": "^0.10.0",
"typescript": "^3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/client-kinesis-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@aws-sdk/karma-credential-loader": "^0.1.0-preview.4",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"jasmine-core": "^2.8.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/client-kms-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@aws-sdk/karma-credential-loader": "^0.1.0-preview.4",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"jasmine-core": "^2.8.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/client-kms-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
},
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"rimraf": "^2.6.2",
"typedoc": "^0.10.0",
"typescript": "^3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/client-lambda-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
},
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"@types/node": "^8.10.29",
"jest": "^20.0.4",
"jest": "^24.7.1",
"rimraf": "^2.6.2",
"typedoc": "^0.10.0",
"typescript": "^3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/client-pinpoint-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@aws-sdk/karma-credential-loader": "^0.1.0-preview.4",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"jasmine-core": "^2.8.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/client-s3-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"devDependencies": {
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
"@aws-sdk/karma-credential-loader": "^0.1.0-preview.4",
"@types/jest": "^20.0.2",
"@types/jest": "^24.0.12",
"jasmine-core": "^2.8.0",
"jest": "^20.0.4",
"jest": "^24.7.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
Expand Down
Loading

0 comments on commit 1e156ab

Please sign in to comment.