Skip to content

Commit f198641

Browse files
committed
Compile tests on their own
1 parent c7fca61 commit f198641

File tree

8 files changed

+53
-24
lines changed

8 files changed

+53
-24
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
"build:tsc": "tsc --project tsconfig.prod.json && tsc --project tsconfig.prod.esm.json",
298298
"test": "npm-run-all test:node",
299299
"test:node": "cd test && npm install && cd .. && mocha",
300-
"clean": "rimraf test-builds bip39 '*.js' '*.js.map' '*.d.ts' '*.d.ts.map' 'src/**/*.js'",
300+
"clean": "rimraf test/test-builds bip39 '*.js' '*.js.map' '*.d.ts' '*.d.ts.map' 'src/**/*.js'",
301301
"lint": "eslint",
302302
"lint:fix": "eslint --fix",
303303
"browser-tests": "npm-run-all browser-tests:build browser-tests:test",
@@ -361,4 +361,4 @@
361361
"context": "browser"
362362
}
363363
}
364-
}
364+
}

scripts/build-browser-tests.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
set -e
22

3+
cd ./test/
4+
echo "Install package to tests"
5+
# Cleanup old module build
6+
rm -rf ./node_modules
7+
npm install
8+
39
echo "Building tests with TypeScript"
4-
npx tsc --project tsconfig.json
10+
npx tsc --project ./tsconfig.json
511

612
echo "Building tests with Parcel"
7-
npx parcel build --no-cache --no-optimize test-builds/tsc/test/test-vectors/*.js --dist-dir test-builds/parcel --target parcel_tests
13+
npx parcel build --no-cache --no-optimize ./test-builds/tsc/test/test-vectors/*.js --dist-dir ./test-builds/parcel --target parcel_tests
814

915
echo "Building tests with Browserify"
10-
npx browserify test-builds/tsc/test/test-vectors/*.js > test-builds/browserify-build.js
16+
npx browserify ./test-builds/tsc/test/test-vectors/*.js > ./test-builds/browserify-build.js
1117

1218
echo "Building tests with webpack"
1319
npx webpack --mode development ./test-builds/tsc/test/test-vectors/*.js --output-path ./test-builds
1420

1521
echo "Building tests with Rollup"
16-
rollup -c test/rollup.config.js
22+
rollup -c ./rollup.config.js

test/karma.browserify.conf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function(config) {
1+
module.exports = function (config) {
22
config.set({
33
frameworks: ["mocha"],
4-
files: ["../test-builds/browserify-build.js"],
4+
files: ["./test-builds/browserify-build.js"],
55
colors: true,
66
logLevel: config.LOG_INFO,
77
browsers: ["ChromeHeadless"],
@@ -12,7 +12,7 @@ module.exports = function(config) {
1212
concurrency: Infinity,
1313
reporters: ["mocha"],
1414
client: {
15-
captureConsole: true
16-
}
15+
captureConsole: true,
16+
},
1717
});
1818
};

test/karma.parcel.conf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function(config) {
1+
module.exports = function (config) {
22
config.set({
33
frameworks: ["mocha"],
4-
files: ["../test-builds/parcel/*.js"],
4+
files: ["./test-builds/parcel/*.js"],
55
colors: true,
66
logLevel: config.LOG_INFO,
77
browsers: ["ChromeHeadless"],
@@ -12,7 +12,7 @@ module.exports = function(config) {
1212
concurrency: Infinity,
1313
reporters: ["mocha"],
1414
client: {
15-
captureConsole: true
16-
}
15+
captureConsole: true,
16+
},
1717
});
1818
};

test/karma.rollup.conf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function(config) {
1+
module.exports = function (config) {
22
config.set({
33
frameworks: ["mocha"],
4-
files: ["../test-builds/rollup/*.js"],
4+
files: ["./test-builds/rollup/*.js"],
55
colors: true,
66
logLevel: config.LOG_INFO,
77
browsers: ["ChromeHeadless"],
@@ -12,7 +12,7 @@ module.exports = function(config) {
1212
concurrency: Infinity,
1313
reporters: ["mocha"],
1414
client: {
15-
captureConsole: true
16-
}
15+
captureConsole: true,
16+
},
1717
});
1818
};

test/karma.webpack.conf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function(config) {
1+
module.exports = function (config) {
22
config.set({
33
frameworks: ["mocha"],
4-
files: ["../test-builds/main.js"],
4+
files: ["./test-builds/main.js"],
55
colors: true,
66
logLevel: config.LOG_INFO,
77
browsers: ["ChromeHeadless"],
@@ -12,7 +12,7 @@ module.exports = function(config) {
1212
concurrency: Infinity,
1313
reporters: ["mocha"],
1414
client: {
15-
captureConsole: true
16-
}
15+
captureConsole: true,
16+
},
1717
});
1818
};

test/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"author": "",
1111
"license": "ISC",
1212
"dependencies": {
13-
"ethereum-cryptography": "file:.."
13+
"ethereum-cryptography": "file:..",
14+
"@types/mocha": "9.1.1"
15+
},
16+
"targets": {
17+
"parcel_tests": {
18+
"context": "browser"
19+
}
1420
}
15-
}
21+
}

test/tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2020",
4+
"module": "commonjs",
5+
"strict": true,
6+
"downlevelIteration": true,
7+
"rootDirs": [
8+
"./"
9+
],
10+
"outDir": "./test-builds/tsc",
11+
"noUnusedLocals": true,
12+
"declaration": true
13+
},
14+
"include": [
15+
"./**/*.ts",
16+
]
17+
}

0 commit comments

Comments
 (0)