Skip to content

Commit

Permalink
test: refactor (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Jul 26, 2024
1 parent 8037ae3 commit f34afc4
Show file tree
Hide file tree
Showing 8 changed files with 2,182 additions and 2,433 deletions.
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ module.exports = (api) => {
[
"@babel/preset-env",
{
exclude:
process.env.NODE_ENV === "test" ? [] : ["proposal-dynamic-import"],
exclude: ["proposal-dynamic-import"],
targets: {
node: "18.12.0",
},
Expand Down
41 changes: 0 additions & 41 deletions globalSetup.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const path = require("path");
const fs = require("fs");

const webpack = require("webpack");

const removeIllegalCharacterForWindows = require("./test/helpers/removeIllegalCharacterForWindows");

const baseDir = path.resolve(__dirname, "test/fixtures");
Expand All @@ -21,43 +19,4 @@ module.exports = () => {
fs.mkdirSync(path.join(baseDir, dir), { recursive: true });
fs.writeFileSync(path.join(baseDir, file), specialFiles[originFile]);
});

return Promise.resolve()
.then(() => {
const compiler = webpack({
devtool: false,
mode: "development",
target: "node",
entry: path.resolve(__dirname, "node_modules/globby/index.js"),
output: {
path: path.resolve(__dirname, "test/bundled/globby"),
filename: "index.js",
library: {
type: "commonjs2",
},
},
});

return new Promise((resolve, reject) => {
compiler.run((error, stats) => {
if (error) {
reject(error);

return;
}

// eslint-disable-next-line no-console
console.log(stats.toString());

compiler.close(() => {
resolve();
});
});
});
})
.catch((error) => {
// eslint-disable-next-line no-console
console.log(error);
process.exit(1);
});
};
9 changes: 0 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
module.exports = {
testEnvironment: "node",
moduleNameMapper: {
"^globby$": "<rootDir>/test/bundled/globby/index.js",
"^node:fs$": "<rootDir>/test/helpers/built-in-modules/fs.js",
"^node:util$": "<rootDir>/test/helpers/built-in-modules/util.js",
"^node:path$": "<rootDir>/test/helpers/built-in-modules/path.js",
"^node:url$": "<rootDir>/test/helpers/built-in-modules/url.js",
"^node:process$": "<rootDir>/test/helpers/built-in-modules/process.js",
"^node:stream$": "<rootDir>/test/helpers/built-in-modules/stream.js",
},
globalSetup: "<rootDir>/globalSetup.js",
};
Loading

0 comments on commit f34afc4

Please sign in to comment.