Skip to content

Update test env #28

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

Merged
merged 13 commits into from
Mar 22, 2018
Merged
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sudo: false
language: node_js
node_js: "stable"
node_js: "stable"
install:
- yarn install --frozen-lockfile
- yarn bootstrap
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ See [Releases page](https://github.com/azu/immutable-array-prototype/releases).

## Running tests

Install devDependencies and Run `yarn test`:
Run following commands:

yarn install
yarn bootstrap
yarn test

## Contributing
Expand Down
4 changes: 3 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"packages": [
"packages/*"
],
"version": "1.0.3"
"version": "1.0.3",
"npmClient": "yarn",
"useWorkspaces": true
}
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@
"publish": "lerna publish --conventional-commits --concurrency 1",
"publish:beta": "lerna publish --npm-tag=beta --conventional-commits --concurrency 1",
"bootstrap": "lerna bootstrap",
"prepare": "npm run bootstrap",
"test": "jest",
"test": "yarn run build && jest",
"build": "lerna run build"
},
"workspaces": [
"packages/*"
],
"lint-staged": {
"**/*.{ts,tsx}": [
"prettier --write",
"git add"
]
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/test/.*-(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
"projects": [
"packages/*"
],
"testMatch": [
"**/?(*.)(spec|test).ts?(x)"
]
},
"keywords": [
Expand All @@ -49,15 +48,15 @@
},
"homepage": "https://github.com/azu/immutable-array-prototype",
"devDependencies": {
"@types/jest": "^20.0.2",
"@types/node": "^8.0.1",
"cross-env": "^5.0.1",
"@types/jest": "^22.2.0",
"@types/node": "^9.4.7",
"cross-env": "^5.1.4",
"husky": "^0.14.3",
"jest": "^20.0.4",
"lerna": "^2.4.0",
"lint-staged": "^4.2.3",
"prettier": "^1.7.4",
"ts-jest": "^20.0.6",
"typescript": "^2.3.4"
"jest": "^22.4.3",
"lerna": "^2.9.0",
"lint-staged": "^7.0.0",
"prettier": "^1.11.1",
"ts-jest": "^22.4.2",
"typescript": "^2.7.2"
}
}
10 changes: 7 additions & 3 deletions packages/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"array": "node src/array.js > output/array.log",
"immutable-array": "node src/immutable-array.js > output/immutable-array.log",
"precompare": "mkdir -p output && npm run array && npm run immutable-array",
"compare": "nanobench-compare output/array.log output/immutable-array.log"
"compare": "nanobench-compare output/array.log output/immutable-array.log",
"test": "jest"
},
"keywords": [
"benchmark"
Expand All @@ -17,6 +18,9 @@
"license": "MIT",
"devDependencies": {
"@immutable-array/prototype": "^1.0.3",
"nanobench": "^2.1.0"
"@types/jest": "^22.2.0",
"jest": "^22.4.3",
"nanobench": "^2.1.0",
"ts-jest": "^22.4.2"
}
}
}
12 changes: 12 additions & 0 deletions packages/copy-within/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
};
8 changes: 6 additions & 2 deletions packages/copy-within/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"watch": "tsc -p . --watch",
"prepublish": "npm run --if-present build"
"prepublish": "npm run --if-present build",
"test": "jest"
},
"publishConfig": {
"access": "public"
Expand All @@ -36,8 +37,11 @@
},
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/copy-within/",
"devDependencies": {
"@types/jest": "^22.2.0",
"@types/node": "^8.0.2",
"cross-env": "^5.0.1",
"jest": "^22.4.3",
"ts-jest": "^22.4.2",
"typescript": "^2.3.4"
}
}
}
8 changes: 4 additions & 4 deletions packages/copy-within/test/copy-within-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { copyWithin } from "../src/copy-within";
describe("copyWithin", () => {
it("should return immutable array", () => {
const originalArray = ["a", "b", "c", "d", "e"];
const resultArray = copyWithin(originalArray, 1);
const resultArray = copyWithin(originalArray, 0, originalArray.length - 1);
assert.ok(originalArray !== resultArray);
});

it("can copyWithin empty array", () => {
const originalArray = [];
assert.deepStrictEqual(originalArray.copyWithin(0), []);
const originalArray: any[] = [];
assert.deepStrictEqual(originalArray.copyWithin(0, 0), []);
});

it("should be idempotent - x() === x()", () => {
const originalArray = ["a", "b", "c", "d", "e"];
assert.deepStrictEqual(originalArray.copyWithin(-2), originalArray.copyWithin(-2));
assert.deepStrictEqual(copyWithin(originalArray, -2, 1), copyWithin(originalArray, -2, 1));
});

it("should work copyWithin", () => {
Expand Down
8 changes: 6 additions & 2 deletions packages/fill/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"watch": "tsc -p . --watch",
"prepublish": "npm run --if-present build"
"prepublish": "npm run --if-present build",
"test": "jest"
},
"publishConfig": {
"access": "public"
Expand All @@ -36,8 +37,11 @@
},
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/fill/",
"devDependencies": {
"@types/jest": "^22.2.0",
"@types/node": "^8.0.2",
"cross-env": "^5.0.1",
"jest": "^22.4.3",
"ts-jest": "^22.4.2",
"typescript": "^2.3.4"
}
}
}
12 changes: 12 additions & 0 deletions packages/pop/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
};
8 changes: 6 additions & 2 deletions packages/pop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"watch": "tsc -p . --watch",
"prepublish": "npm run --if-present build"
"prepublish": "npm run --if-present build",
"test": "jest"
},
"publishConfig": {
"access": "public"
Expand All @@ -36,8 +37,11 @@
},
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/pop/",
"devDependencies": {
"@types/jest": "^22.2.0",
"@types/node": "^8.0.2",
"cross-env": "^5.0.1",
"jest": "^22.4.3",
"ts-jest": "^22.4.2",
"typescript": "^2.3.4"
}
}
}
2 changes: 1 addition & 1 deletion packages/pop/test/pop-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pop } from "../src/pop";

describe("pop", () => {
it("should return empty array when pop empty array", () => {
const originalArray = [];
const originalArray: any[] = [];
const resultArray = pop(originalArray);
assert.deepStrictEqual(resultArray, []);
});
Expand Down
12 changes: 12 additions & 0 deletions packages/prototype/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
};
8 changes: 6 additions & 2 deletions packages/prototype/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"watch": "tsc -p . --watch",
"prepublish": "npm run --if-present build"
"prepublish": "npm run --if-present build",
"test": "jest"
},
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -50,8 +51,11 @@
"@immutable-array/unshift": "^1.0.1"
},
"devDependencies": {
"@types/jest": "^22.2.0",
"@types/node": "^8.0.2",
"cross-env": "^5.0.1",
"jest": "^22.4.3",
"ts-jest": "^22.4.2",
"typescript": "^2.3.4"
}
}
}
12 changes: 12 additions & 0 deletions packages/push/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
};
8 changes: 6 additions & 2 deletions packages/push/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"watch": "tsc -p . --watch",
"prepublish": "npm run --if-present build"
"prepublish": "npm run --if-present build",
"test": "jest"
},
"publishConfig": {
"access": "public"
Expand All @@ -36,8 +37,11 @@
},
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/push/",
"devDependencies": {
"@types/jest": "^22.2.0",
"@types/node": "^8.0.2",
"cross-env": "^5.0.1",
"jest": "^22.4.3",
"ts-jest": "^22.4.2",
"typescript": "^2.3.4"
}
}
}
8 changes: 4 additions & 4 deletions packages/push/test/push-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as assert from "assert";

describe("push", () => {
it("can push element to empty array", () => {
const originalArray = [];
const originalArray: string[] = [];
const resultArray = push(originalArray, "a");
assert.deepStrictEqual(resultArray, ["a"]);
});
Expand All @@ -17,15 +17,15 @@ describe("push", () => {
it("can push an array", () => {
const originalArray = ["a", "b", "c", "d", "e"];
const addingArray = ["f", "g"];
const resultArray = push(originalArray, addingArray);
const resultArray = push<any>(originalArray, addingArray);
assert.deepStrictEqual(resultArray, ["a", "b", "c", "d", "e", ["f", "g"]]);
});
it("should be idempotent - x() === x()", () => {
const originalArray = ["a", "b", "c", "d", "e"];
assert.deepStrictEqual(push(originalArray, 1), push(originalArray, 1));
assert.deepStrictEqual(push<string | number>(originalArray, 1), push(originalArray, 1));
});
it("should return empty array when adding empty element to empty array", () => {
const originalArray = [];
const originalArray: any[] = [];
const resultArray = push(originalArray);
assert.strictEqual(resultArray.length, 0);
});
Expand Down
12 changes: 12 additions & 0 deletions packages/reverse/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
};
8 changes: 6 additions & 2 deletions packages/reverse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"watch": "tsc -p . --watch",
"prepublish": "npm run --if-present build"
"prepublish": "npm run --if-present build",
"test": "jest"
},
"publishConfig": {
"access": "public"
Expand All @@ -36,8 +37,11 @@
},
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/reverse/",
"devDependencies": {
"@types/jest": "^22.2.0",
"@types/node": "^8.0.2",
"cross-env": "^5.0.1",
"jest": "^22.4.3",
"ts-jest": "^22.4.2",
"typescript": "^2.3.4"
}
}
}
12 changes: 12 additions & 0 deletions packages/shift/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
};
Loading