-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
rollup-tests.config.cjs
48 lines (45 loc) · 1.38 KB
/
rollup-tests.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import babel from "@rollup/plugin-babel";
import builtins from "rollup-plugin-node-builtins";
import clear from "rollup-plugin-clear";
import externalGlobals from "rollup-plugin-external-globals";
import replace from "@rollup/plugin-replace";
import resolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
function createTestConfig(input) {
const targetDir = "compiled_tests";
return {
input: `src/fns/__tests__/${input}.test.js`,
output: {
file: `${targetDir}/${input}.test.js`,
format: "iife",
sourcemap: true,
sourcemapFile: `compiled_tests/${input}.test.js.map`,
exports: "auto",
},
plugins: [
clear({ targets: [targetDir] }),
replace({
[`requireFunction("${input}")`]: `numberGenerator.${input}`,
'require("../../reference/cpp/results.json")': `(${JSON.stringify(
require("./src/reference/cpp/results.json"),
)})`,
delimiters: ["", ""],
preventAssignment: true,
}),
externalGlobals({
chai: "chai",
}),
builtins(),
resolve(),
babel({ babelHelpers: "bundled" }),
terser(),
],
};
}
export default [
createTestConfig("aleaRNGFactory"),
createTestConfig("murmurhash2_x86_32"),
createTestConfig("murmurhash3_x64_128"),
createTestConfig("murmurhash3_x86_32"),
createTestConfig("murmurhash3_x86_128"),
];