Skip to content

Commit f37b6e7

Browse files
authored
Merge pull request #28 from azu/update-test
Update test env
2 parents 7ff6668 + 541ecf3 commit f37b6e7

32 files changed

+2438
-734
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
sudo: false
22
language: node_js
3-
node_js: "stable"
3+
node_js: "stable"
4+
install:
5+
- yarn install --frozen-lockfile
6+
- yarn bootstrap

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,10 @@ See [Releases page](https://github.com/azu/immutable-array-prototype/releases).
231231

232232
## Running tests
233233

234-
Install devDependencies and Run `yarn test`:
234+
Run following commands:
235235

236+
yarn install
237+
yarn bootstrap
236238
yarn test
237239

238240
## Contributing

lerna.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "1.0.3"
6+
"version": "1.0.3",
7+
"npmClient": "yarn",
8+
"useWorkspaces": true
79
}

package.json

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@
1313
"publish": "lerna publish --conventional-commits --concurrency 1",
1414
"publish:beta": "lerna publish --npm-tag=beta --conventional-commits --concurrency 1",
1515
"bootstrap": "lerna bootstrap",
16-
"prepare": "npm run bootstrap",
17-
"test": "jest",
16+
"test": "yarn run build && jest",
1817
"build": "lerna run build"
1918
},
19+
"workspaces": [
20+
"packages/*"
21+
],
2022
"lint-staged": {
2123
"**/*.{ts,tsx}": [
2224
"prettier --write",
2325
"git add"
2426
]
2527
},
2628
"jest": {
27-
"transform": {
28-
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
29-
},
30-
"testRegex": "(/test/.*-(test|spec))\\.(ts|tsx|js)$",
31-
"moduleFileExtensions": [
32-
"ts",
33-
"tsx",
34-
"js"
29+
"projects": [
30+
"packages/*"
31+
],
32+
"testMatch": [
33+
"**/?(*.)(spec|test).ts?(x)"
3534
]
3635
},
3736
"keywords": [
@@ -49,15 +48,15 @@
4948
},
5049
"homepage": "https://github.com/azu/immutable-array-prototype",
5150
"devDependencies": {
52-
"@types/jest": "^20.0.2",
53-
"@types/node": "^8.0.1",
54-
"cross-env": "^5.0.1",
51+
"@types/jest": "^22.2.0",
52+
"@types/node": "^9.4.7",
53+
"cross-env": "^5.1.4",
5554
"husky": "^0.14.3",
56-
"jest": "^20.0.4",
57-
"lerna": "^2.4.0",
58-
"lint-staged": "^4.2.3",
59-
"prettier": "^1.7.4",
60-
"ts-jest": "^20.0.6",
61-
"typescript": "^2.3.4"
55+
"jest": "^22.4.3",
56+
"lerna": "^2.9.0",
57+
"lint-staged": "^7.0.0",
58+
"prettier": "^1.11.1",
59+
"ts-jest": "^22.4.2",
60+
"typescript": "^2.7.2"
6261
}
6362
}

packages/benchmark/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"array": "node src/array.js > output/array.log",
99
"immutable-array": "node src/immutable-array.js > output/immutable-array.log",
1010
"precompare": "mkdir -p output && npm run array && npm run immutable-array",
11-
"compare": "nanobench-compare output/array.log output/immutable-array.log"
11+
"compare": "nanobench-compare output/array.log output/immutable-array.log",
12+
"test": "jest"
1213
},
1314
"keywords": [
1415
"benchmark"
@@ -17,6 +18,9 @@
1718
"license": "MIT",
1819
"devDependencies": {
1920
"@immutable-array/prototype": "^1.0.3",
20-
"nanobench": "^2.1.0"
21+
"@types/jest": "^22.2.0",
22+
"jest": "^22.4.3",
23+
"nanobench": "^2.1.0",
24+
"ts-jest": "^22.4.2"
2125
}
22-
}
26+
}

packages/copy-within/jest.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
"transform": {
3+
".(ts|tsx)": "ts-jest"
4+
},
5+
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
6+
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
7+
"moduleFileExtensions": [
8+
"ts",
9+
"tsx",
10+
"js"
11+
]
12+
};

packages/copy-within/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"scripts": {
1919
"build": "cross-env NODE_ENV=production tsc -p .",
2020
"watch": "tsc -p . --watch",
21-
"prepublish": "npm run --if-present build"
21+
"prepublish": "npm run --if-present build",
22+
"test": "jest"
2223
},
2324
"publishConfig": {
2425
"access": "public"
@@ -36,8 +37,11 @@
3637
},
3738
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/copy-within/",
3839
"devDependencies": {
40+
"@types/jest": "^22.2.0",
3941
"@types/node": "^8.0.2",
4042
"cross-env": "^5.0.1",
43+
"jest": "^22.4.3",
44+
"ts-jest": "^22.4.2",
4145
"typescript": "^2.3.4"
4246
}
43-
}
47+
}

packages/copy-within/test/copy-within-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import { copyWithin } from "../src/copy-within";
55
describe("copyWithin", () => {
66
it("should return immutable array", () => {
77
const originalArray = ["a", "b", "c", "d", "e"];
8-
const resultArray = copyWithin(originalArray, 1);
8+
const resultArray = copyWithin(originalArray, 0, originalArray.length - 1);
99
assert.ok(originalArray !== resultArray);
1010
});
1111

1212
it("can copyWithin empty array", () => {
13-
const originalArray = [];
14-
assert.deepStrictEqual(originalArray.copyWithin(0), []);
13+
const originalArray: any[] = [];
14+
assert.deepStrictEqual(originalArray.copyWithin(0, 0), []);
1515
});
1616

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

2222
it("should work copyWithin", () => {

packages/fill/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"scripts": {
1919
"build": "cross-env NODE_ENV=production tsc -p .",
2020
"watch": "tsc -p . --watch",
21-
"prepublish": "npm run --if-present build"
21+
"prepublish": "npm run --if-present build",
22+
"test": "jest"
2223
},
2324
"publishConfig": {
2425
"access": "public"
@@ -36,8 +37,11 @@
3637
},
3738
"homepage": "https://github.com/azu/immutable-array-prototype/tree/master/packages/fill/",
3839
"devDependencies": {
40+
"@types/jest": "^22.2.0",
3941
"@types/node": "^8.0.2",
4042
"cross-env": "^5.0.1",
43+
"jest": "^22.4.3",
44+
"ts-jest": "^22.4.2",
4145
"typescript": "^2.3.4"
4246
}
43-
}
47+
}

packages/pop/jest.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
"transform": {
3+
".(ts|tsx)": "ts-jest"
4+
},
5+
"testRegex": "(./test/.*-(test|spec))\\.(ts|tsx|js)$",
6+
"testPathIgnorePatterns": ["/lib/", "/out/", "/node_modules/"],
7+
"moduleFileExtensions": [
8+
"ts",
9+
"tsx",
10+
"js"
11+
]
12+
};

0 commit comments

Comments
 (0)